/**
 *
 */
import Util;
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-beijing' = 'gpdb.aliyuncs.com',
    'cn-hangzhou' = 'gpdb.aliyuncs.com',
    'cn-shanghai' = 'gpdb.aliyuncs.com',
    'cn-shenzhen' = 'gpdb.aliyuncs.com',
    'cn-hongkong' = 'gpdb.aliyuncs.com',
    'ap-southeast-1' = 'gpdb.aliyuncs.com',
    'us-west-1' = 'gpdb.aliyuncs.com',
    'us-east-1' = 'gpdb.aliyuncs.com',
    'cn-hangzhou-finance' = 'gpdb.aliyuncs.com',
    'cn-shanghai-finance-1' = 'gpdb.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'gpdb.aliyuncs.com',
    'cn-qingdao' = 'gpdb.aliyuncs.com',
    'cn-north-2-gov-1' = 'gpdb.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('gpdb', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ColumnMetadata {
  columnDefault?: string(name='ColumnDefault'),
  comment?: string(name='Comment'),
  dataType?: string(name='DataType'),
  isCaseSensitive?: boolean(name='IsCaseSensitive'),
  isCurrency?: boolean(name='IsCurrency'),
  isPrimaryKey?: boolean(name='IsPrimaryKey'),
  isSigned?: boolean(name='IsSigned'),
  maxLength?: int32(name='MaxLength'),
  name?: string(name='Name'),
  nullable?: boolean(name='Nullable'),
  precision?: int32(name='Precision'),
  scale?: int32(name='Scale'),
  schemaName?: string(name='SchemaName'),
  tableName?: string(name='TableName'),
  udtName?: string(name='UdtName'),
}

model Field {
  blobValue?: string(name='BlobValue'),
  booleanValue?: boolean(name='BooleanValue'),
  doubleValue?: double(name='DoubleValue'),
  isNull?: boolean(name='IsNull'),
  longValue?: long(name='LongValue'),
  stringValue?: string(name='StringValue'),
}

model StatementData {
  createdAt?: string(name='CreatedAt'),
  database?: string(name='Database'),
  id?: string(name='Id'),
  parameters?: [ string ](name='Parameters'),
  secretArn?: string(name='SecretArn'),
  sql?: string(name='Sql'),
  sqls?: [ string ](name='Sqls'),
  status?: string(name='Status'),
  updatedAt?: string(name='UpdatedAt'),
}

model AllocateInstancePublicConnectionRequest {
  addressType?: string(name='AddressType', description='The network type of the endpoint. Valid values:

*   **primary**: primary endpoint
*   **cluster**: instance endpoint. This value is supported only for an instance that contains multiple coordinator nodes.

>  The default value is primary.', example='primary'),
  connectionStringPrefix?: string(name='ConnectionStringPrefix', description='The prefix of the endpoint.

Specify a prefix for the endpoint. Example: `gp-bp12ga6v69h86****`. In this example, the endpoint is `gp-bp12ga6v69h86****.gpdb.rds.aliyuncs.com`.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  port?: string(name='Port', description='The port number. Example: 5432.

This parameter is required.', example='5432'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model AllocateInstancePublicConnectionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='ADD6EA90-EECB-4C12-9F26-0B6DB587****'),
}

model AllocateInstancePublicConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AllocateInstancePublicConnectionResponseBody(name='body'),
}

/**
 * @summary Allocates a public endpoint for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to apply for a public endpoint for an AnalyticDB for PostgreSQL instance. Both the primary and instance endpoints of an AnalyticDB for PostgreSQL instance can be public endpoints. For more information, see [Endpoints of an instance and its primary coordinator node](https://help.aliyun.com/document_detail/204879.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request AllocateInstancePublicConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AllocateInstancePublicConnectionResponse
 */
async function allocateInstancePublicConnectionWithOptions(request: AllocateInstancePublicConnectionRequest, runtime: Util.RuntimeOptions): AllocateInstancePublicConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.connectionStringPrefix)) {
    query['ConnectionStringPrefix'] = request.connectionStringPrefix;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AllocateInstancePublicConnection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Allocates a public endpoint for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to apply for a public endpoint for an AnalyticDB for PostgreSQL instance. Both the primary and instance endpoints of an AnalyticDB for PostgreSQL instance can be public endpoints. For more information, see [Endpoints of an instance and its primary coordinator node](https://help.aliyun.com/document_detail/204879.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request AllocateInstancePublicConnectionRequest
 * @return AllocateInstancePublicConnectionResponse
 */
async function allocateInstancePublicConnection(request: AllocateInstancePublicConnectionRequest): AllocateInstancePublicConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return allocateInstancePublicConnectionWithOptions(request, runtime);
}

model BindDBResourceGroupWithRoleRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
  roleList?: [ string ](name='RoleList', description='The roles.

This parameter is required.'),
}

model BindDBResourceGroupWithRoleShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
  roleListShrink?: string(name='RoleList', description='The roles.

This parameter is required.'),
}

model BindDBResourceGroupWithRoleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model BindDBResourceGroupWithRoleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BindDBResourceGroupWithRoleResponseBody(name='body'),
}

/**
 * @summary Binds a resource group to a database role.
 *
 * @param tmpReq BindDBResourceGroupWithRoleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BindDBResourceGroupWithRoleResponse
 */
async function bindDBResourceGroupWithRoleWithOptions(tmpReq: BindDBResourceGroupWithRoleRequest, runtime: Util.RuntimeOptions): BindDBResourceGroupWithRoleResponse {
  Util.validateModel(tmpReq);
  var request = new BindDBResourceGroupWithRoleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.roleList)) {
    request.roleListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.roleList, 'RoleList', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  if (!Util.isUnset(request.roleListShrink)) {
    query['RoleList'] = request.roleListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BindDBResourceGroupWithRole',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Binds a resource group to a database role.
 *
 * @param request BindDBResourceGroupWithRoleRequest
 * @return BindDBResourceGroupWithRoleResponse
 */
async function bindDBResourceGroupWithRole(request: BindDBResourceGroupWithRoleRequest): BindDBResourceGroupWithRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return bindDBResourceGroupWithRoleWithOptions(request, runtime);
}

model CancelCreateIndexJobRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='This parameter is required.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model CancelCreateIndexJobResponseBody = {
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model CancelCreateIndexJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelCreateIndexJobResponseBody(name='body'),
}

/**
 * @summary 取消创建索引任务
 *
 * @param request CancelCreateIndexJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelCreateIndexJobResponse
 */
async function cancelCreateIndexJobWithOptions(request: CancelCreateIndexJobRequest, runtime: Util.RuntimeOptions): CancelCreateIndexJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CancelCreateIndexJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 取消创建索引任务
 *
 * @param request CancelCreateIndexJobRequest
 * @return CancelCreateIndexJobResponse
 */
async function cancelCreateIndexJob(request: CancelCreateIndexJobRequest): CancelCreateIndexJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelCreateIndexJobWithOptions(request, runtime);
}

model CancelUploadDocumentJobRequest {
  collection?: string(name='Collection', description='The name of the document collection.

>  You can call the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) operation to create a document collection and call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) operation to query a list of document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance for which vector engine optimization is enabled.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='The ID of the document upload job. You can call the `UploadDocumentAsync` operation to query the job ID.

This parameter is required.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model CancelUploadDocumentJobResponseBody = {
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model CancelUploadDocumentJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelUploadDocumentJobResponseBody(name='body'),
}

/**
 * @summary Cancels an asynchronous document upload job based on the job ID.
 *
 * @description This operation is related to the UploadDocumentAsync operation. You can call this operation to cancel a document upload job.
 * >  If the canceling operation is complete, failed, or is canceled, you cannot call the operation again. The canceling operation only interrupts the document upload job. To remove the uploaded data, you must manually remove it or call the DeleteCollectionData operation. You can also call the document upload operation to overwrite the data by using the same FileName parameter.
 *
 * @param request CancelUploadDocumentJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelUploadDocumentJobResponse
 */
async function cancelUploadDocumentJobWithOptions(request: CancelUploadDocumentJobRequest, runtime: Util.RuntimeOptions): CancelUploadDocumentJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelUploadDocumentJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Cancels an asynchronous document upload job based on the job ID.
 *
 * @description This operation is related to the UploadDocumentAsync operation. You can call this operation to cancel a document upload job.
 * >  If the canceling operation is complete, failed, or is canceled, you cannot call the operation again. The canceling operation only interrupts the document upload job. To remove the uploaded data, you must manually remove it or call the DeleteCollectionData operation. You can also call the document upload operation to overwrite the data by using the same FileName parameter.
 *
 * @param request CancelUploadDocumentJobRequest
 * @return CancelUploadDocumentJobResponse
 */
async function cancelUploadDocumentJob(request: CancelUploadDocumentJobRequest): CancelUploadDocumentJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelUploadDocumentJobWithOptions(request, runtime);
}

model CancelUpsertCollectionDataJobRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='The ID of the vector data upload job. You can call the `UpsertCollectionDataAsync` operation to query the job ID.

This parameter is required.', example='bf8f7bc4-9276-44f7-9c22-1d06edc8dfd1'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model CancelUpsertCollectionDataJobResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model CancelUpsertCollectionDataJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelUpsertCollectionDataJobResponseBody(name='body'),
}

/**
 * @summary Cancels an asynchronous vector data upload job by using a job ID.
 *
 * @description This operation is related to the `UpsertCollectionDataAsync` operation. You can call this operation to cancel an upload job.
 * >  If the canceling operation is complete, failed, or is canceled, you cannot call the operation again. The canceling operation only interrupts the upload job. To remove the uploaded data, you must manually remove it or call the DeleteCollectionData operation.
 *
 * @param request CancelUpsertCollectionDataJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelUpsertCollectionDataJobResponse
 */
async function cancelUpsertCollectionDataJobWithOptions(request: CancelUpsertCollectionDataJobRequest, runtime: Util.RuntimeOptions): CancelUpsertCollectionDataJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelUpsertCollectionDataJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Cancels an asynchronous vector data upload job by using a job ID.
 *
 * @description This operation is related to the `UpsertCollectionDataAsync` operation. You can call this operation to cancel an upload job.
 * >  If the canceling operation is complete, failed, or is canceled, you cannot call the operation again. The canceling operation only interrupts the upload job. To remove the uploaded data, you must manually remove it or call the DeleteCollectionData operation.
 *
 * @param request CancelUpsertCollectionDataJobRequest
 * @return CancelUpsertCollectionDataJobResponse
 */
async function cancelUpsertCollectionDataJob(request: CancelUpsertCollectionDataJobRequest): CancelUpsertCollectionDataJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelUpsertCollectionDataJobWithOptions(request, runtime);
}

model CheckHadoopDataSourceRequest {
  checkDir?: string(name='CheckDir', description='The Hadoop path that you want to check.

This parameter is required.', example='tmp'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.

This parameter is required.', example='123'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model CheckHadoopDataSourceResponseBody = {
  message?: string(name='Message', description='The returned message. If the service failed, an error message is returned. Otherwise, a pair of double quotation marks ("") is returned.', example='serivce unavaliable'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  status?: string(name='Status', description='The status of the service. Valid values:

*   Running
*   Failed', example='Running'),
}

model CheckHadoopDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckHadoopDataSourceResponseBody(name='body'),
}

/**
 * @summary Checks the configurations of a Hadoop data source.
 *
 * @param request CheckHadoopDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckHadoopDataSourceResponse
 */
async function checkHadoopDataSourceWithOptions(request: CheckHadoopDataSourceRequest, runtime: Util.RuntimeOptions): CheckHadoopDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.checkDir)) {
    query['CheckDir'] = request.checkDir;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckHadoopDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Checks the configurations of a Hadoop data source.
 *
 * @param request CheckHadoopDataSourceRequest
 * @return CheckHadoopDataSourceResponse
 */
async function checkHadoopDataSource(request: CheckHadoopDataSourceRequest): CheckHadoopDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkHadoopDataSourceWithOptions(request, runtime);
}

model CheckHadoopNetConnectionRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceId?: string(name='DataSourceId', description='1. Either DataSourceId or EmrInstanceId must be specified as input, otherwise an error will occur.
2. If both of the above parameters are specified, EmrInstanceId will be used preferentially.
3. If the data source specified by DataSourceId is a self-built Hadoop cluster, an error will occur directly.', example='126'),
  emrInstanceId?: string(name='EmrInstanceId', description='EMR instance ID.', example='c-xxx'),
  regionId?: string(name='RegionId', description='Region ID.', example='cn-hangzhou'),
}

model CheckHadoopNetConnectionResponseBody = {
  connectionMessage?: string(name='ConnectionMessage', description='Return message: Returns error information if the connection fails, otherwise returns an empty string ("").', example='connection timeout'),
  connectionStatus?: string(name='ConnectionStatus', description='Connection status:

- Network connected: Success

- Network not connected: Failed', example='Success'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CheckHadoopNetConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckHadoopNetConnectionResponseBody(name='body'),
}

/**
 * @summary Check Hadoop Cluster Network Connectivity
 *
 * @param request CheckHadoopNetConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckHadoopNetConnectionResponse
 */
async function checkHadoopNetConnectionWithOptions(request: CheckHadoopNetConnectionRequest, runtime: Util.RuntimeOptions): CheckHadoopNetConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.emrInstanceId)) {
    query['EmrInstanceId'] = request.emrInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckHadoopNetConnection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Check Hadoop Cluster Network Connectivity
 *
 * @param request CheckHadoopNetConnectionRequest
 * @return CheckHadoopNetConnectionResponse
 */
async function checkHadoopNetConnection(request: CheckHadoopNetConnectionRequest): CheckHadoopNetConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkHadoopNetConnectionWithOptions(request, runtime);
}

model CheckJDBCSourceNetConnectionRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceId?: string(name='DataSourceId', description='Either DataSourceId or JdbcConnectionString must be specified as input, otherwise an error will occur. If both parameters are specified, JdbcConnectionString will be used preferentially.', example='123'),
  jdbcConnectionString?: string(name='JdbcConnectionString', description='JDBC connection string.', example='jdbc:mysql://rm-xxx.mysql.rds.aliyuncs.com:3306/testadmin'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance is located.', example='cn-hangzhou'),
}

model CheckJDBCSourceNetConnectionResponseBody = {
  connectionMessage?: string(name='ConnectionMessage', description='Return message: Error message returned when the connection fails, otherwise returns an empty string ("").', example='connection timeout'),
  connectionStatus?: string(name='ConnectionStatus', description='Service status:

- Network connected: Success

- Network not connected: Failed', example='Success'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CheckJDBCSourceNetConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckJDBCSourceNetConnectionResponseBody(name='body'),
}

/**
 * @summary Check the network connectivity of the JDBC connection string
 *
 * @param request CheckJDBCSourceNetConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckJDBCSourceNetConnectionResponse
 */
async function checkJDBCSourceNetConnectionWithOptions(request: CheckJDBCSourceNetConnectionRequest, runtime: Util.RuntimeOptions): CheckJDBCSourceNetConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.jdbcConnectionString)) {
    query['JdbcConnectionString'] = request.jdbcConnectionString;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckJDBCSourceNetConnection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Check the network connectivity of the JDBC connection string
 *
 * @param request CheckJDBCSourceNetConnectionRequest
 * @return CheckJDBCSourceNetConnectionResponse
 */
async function checkJDBCSourceNetConnection(request: CheckJDBCSourceNetConnectionRequest): CheckJDBCSourceNetConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkJDBCSourceNetConnectionWithOptions(request, runtime);
}

model CheckServiceLinkedRoleRequest {
  regionId?: string(name='RegionId', description='The ID of the region. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model CheckServiceLinkedRoleResponseBody = {
  hasServiceLinkedRole?: string(name='HasServiceLinkedRole', description='Indicates whether an SLR is created.', example='true'),
  regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CheckServiceLinkedRoleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckServiceLinkedRoleResponseBody(name='body'),
}

/**
 * @summary Queries whether a service-linked role is created.
 *
 * @param request CheckServiceLinkedRoleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckServiceLinkedRoleResponse
 */
async function checkServiceLinkedRoleWithOptions(request: CheckServiceLinkedRoleRequest, runtime: Util.RuntimeOptions): CheckServiceLinkedRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckServiceLinkedRole',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether a service-linked role is created.
 *
 * @param request CheckServiceLinkedRoleRequest
 * @return CheckServiceLinkedRoleResponse
 */
async function checkServiceLinkedRole(request: CheckServiceLinkedRoleRequest): CheckServiceLinkedRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkServiceLinkedRoleWithOptions(request, runtime);
}

model CloneDBInstanceRequest {
  backupId?: string(name='BackupId', description='This parameter is required.', example='1111111111'),
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
  srcDbInstanceName?: string(name='SrcDbInstanceName', description='This parameter is required.', example='gp-bp***************'),
}

model CloneDBInstanceResponseBody = {
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model CloneDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CloneDBInstanceResponseBody(name='body'),
}

/**
 * @summary 恢复数据至指定实例
 *
 * @param request CloneDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CloneDBInstanceResponse
 */
async function cloneDBInstanceWithOptions(request: CloneDBInstanceRequest, runtime: Util.RuntimeOptions): CloneDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupId)) {
    query['BackupId'] = request.backupId;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.srcDbInstanceName)) {
    query['SrcDbInstanceName'] = request.srcDbInstanceName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CloneDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 恢复数据至指定实例
 *
 * @param request CloneDBInstanceRequest
 * @return CloneDBInstanceResponse
 */
async function cloneDBInstance(request: CloneDBInstanceRequest): CloneDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return cloneDBInstanceWithOptions(request, runtime);
}

model CreateAccountRequest {
  accountDescription?: string(name='AccountDescription', description='The description of the initial account.', example='testacc02'),
  accountName?: string(name='AccountName', description='The name of the initial account.

*   The name can contain lowercase letters, digits, and underscores (_).
*   The name must start with a lowercase letter and end with a lowercase letter or a digit.
*   The name cannot start with gp.
*   The name must be 2 to 16 characters in length.

This parameter is required.', example='testacc02'),
  accountPassword?: string(name='AccountPassword', description='The password of the initial account.
*   The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
*   Special characters include `! @ # $ % ^ & * ( ) _ + - =`
*   The password must be 8 to 32 characters in length.

This parameter is required.', example='Pw123456'),
  accountType?: string(name='AccountType', description='The type of the initial account. Default value: Super, which specifies a privileged account. To create a standard account, set the value to Normal.', example='Super'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  databaseName?: string(name='DatabaseName', description='The name of the database.', example='test01'),
  ownerId?: long(name='OwnerId'),
}

model CreateAccountResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D4D4BE8A-DD46-440A-BFCD-EE**********'),
}

model CreateAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAccountResponseBody(name='body'),
}

/**
 * @summary Creates an initial account for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   Before you can use an AnalyticDB for PostgreSQL instance, you must create an initial account for the instance.
 * *   You can call this operation to create only initial accounts. For information about how to create other types of accounts, see [Create a database account](https://help.aliyun.com/document_detail/50206.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CreateAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAccountResponse
 */
async function createAccountWithOptions(request: CreateAccountRequest, runtime: Util.RuntimeOptions): CreateAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountDescription)) {
    query['AccountDescription'] = request.accountDescription;
  }
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.accountPassword)) {
    query['AccountPassword'] = request.accountPassword;
  }
  if (!Util.isUnset(request.accountType)) {
    query['AccountType'] = request.accountType;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.databaseName)) {
    query['DatabaseName'] = request.databaseName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAccount',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an initial account for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   Before you can use an AnalyticDB for PostgreSQL instance, you must create an initial account for the instance.
 * *   You can call this operation to create only initial accounts. For information about how to create other types of accounts, see [Create a database account](https://help.aliyun.com/document_detail/50206.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CreateAccountRequest
 * @return CreateAccountResponse
 */
async function createAccount(request: CreateAccountRequest): CreateAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAccountWithOptions(request, runtime);
}

model CreateBackupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
}

model CreateBackupResponseBody = {
  backupJobId?: long(name='BackupJobId', example='123'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model CreateBackupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateBackupResponseBody(name='body'),
}

/**
 * @summary 创建备份
 *
 * @param request CreateBackupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateBackupResponse
 */
async function createBackupWithOptions(request: CreateBackupRequest, runtime: Util.RuntimeOptions): CreateBackupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateBackup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建备份
 *
 * @param request CreateBackupRequest
 * @return CreateBackupResponse
 */
async function createBackup(request: CreateBackupRequest): CreateBackupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createBackupWithOptions(request, runtime);
}

model CreateCollectionRequest {
  collection?: string(name='Collection', description='The name of the collection that you want to create.

>  The name must comply with the naming conventions of PostgreSQL objects.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.', example='gp-xxxxxxxxx'),
  dimension?: long(name='Dimension', description='The number of vector dimensions.

>  If you specify this parameter, an index is created. When you call the [UpsertCollectionData](https://help.aliyun.com/document_detail/2401493.html) operation, make sure that the length of the Rows.Vector parameter is the same as the value of this parameter. If you do not specify this parameter, you can call the [CreateVectorIndex](https://help.aliyun.com/document_detail/2401499.html) operation to create an index.', example='1024'),
  externalStorage?: int32(name='ExternalStorage', description='Specifies whether to use the memory mapping technology to create HNSW indexes. Valid values: 0 and 1. Default value: 0. We recommend that you set the value to 1 in scenarios that require upload speed but not data deletion.

> 

*   0: uses segmented paging storage to create indexes. This method uses the shared buffer of PostgreSQL for caching and supports the delete and update operations.

*   1: uses the memory mapping technology to create indexes. This method does not support the delete or update operation.', example='0'),
  fullTextRetrievalFields?: string(name='FullTextRetrievalFields', description='The fields used for full-text search. Separate multiple fields with commas (,). These fields must be keys defined in Metadata.', example='title,content'),
  hnswEfConstruction?: string(name='HnswEfConstruction'),
  hnswM?: int32(name='HnswM', description='The maximum number of neighbors for the Hierarchical Navigable Small World (HNSW) algorithm. Valid values: 1 to 1000. In most cases, this parameter is automatically configured based on the value of the Dimension parameter. You do not need to configure this parameter.

>  We recommend that you configure this parameter based on the value of the Dimension parameter.

*If you set Dimension to a value less than or equal to 384, set the value of HnswM to 16.

*If you set Dimension to a value greater than 384 and less than or equal to 768, set the value of HnswM to 32.

*If you set Dimension to a value greater than 768 and less than or equal to 1024, set the value of HnswM to 64.

*If you set Dimension to a value greater than 1024, set the value of HnswM to 128.', example='64'),
  managerAccount?: string(name='ManagerAccount', description='Name of the management account with rds_superuser permissions.

> You can create an account through the console -> Account Management, or by using the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) API.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  metadata?: string(name='Metadata', description='The metadata of the vector data, which is a JSON string in the MAP format. The key specifies the field name, and the value specifies the data type.

>  Supported data types:

*   For information about the supported data types, see [Data types](https://www.alibabacloud.com/help/zh/analyticdb/analyticdb-for-postgresql/developer-reference/data-types-1/).

*   The money data type is not supported.

**

**Warning** Reserved fields such as id, vector, to_tsvector, and source cannot be used.

This parameter is required.', example='{"title":"text","content":"text","response":"int"}'),
  metadataIndices?: string(name='MetadataIndices', description='The scalar index fields. Separate multiple fields with commas (,). These fields must be keys defined in Metadata.', example='title'),
  metrics?: string(name='Metrics', description='The method that is used to create vector indexes. Valid values:

*   l2: Euclidean distance.
*   ip: inner product distance.
*   cosine: cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  parser?: string(name='Parser', description='The analyzer that is used for full-text search.', example='zh_cn'),
  pqEnable?: int32(name='PqEnable', description='Specifies whether to enable the product quantization (PQ) feature for index acceleration. We recommend that you enable this feature for more than 500,000 rows of data. Valid values:

*   0: no.
*   1 (default): yes.', example='0'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  sparseVectorIndexConfig?: {
    hnswEfConstruction?: int32(name='HnswEfConstruction'),
    hnswM?: int32(name='HnswM'),
  }(name='SparseVectorIndexConfig'),
  supportSparse?: boolean(name='SupportSparse'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model CreateCollectionShrinkRequest {
  collection?: string(name='Collection', description='The name of the collection that you want to create.

>  The name must comply with the naming conventions of PostgreSQL objects.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.', example='gp-xxxxxxxxx'),
  dimension?: long(name='Dimension', description='The number of vector dimensions.

>  If you specify this parameter, an index is created. When you call the [UpsertCollectionData](https://help.aliyun.com/document_detail/2401493.html) operation, make sure that the length of the Rows.Vector parameter is the same as the value of this parameter. If you do not specify this parameter, you can call the [CreateVectorIndex](https://help.aliyun.com/document_detail/2401499.html) operation to create an index.', example='1024'),
  externalStorage?: int32(name='ExternalStorage', description='Specifies whether to use the memory mapping technology to create HNSW indexes. Valid values: 0 and 1. Default value: 0. We recommend that you set the value to 1 in scenarios that require upload speed but not data deletion.

> 

*   0: uses segmented paging storage to create indexes. This method uses the shared buffer of PostgreSQL for caching and supports the delete and update operations.

*   1: uses the memory mapping technology to create indexes. This method does not support the delete or update operation.', example='0'),
  fullTextRetrievalFields?: string(name='FullTextRetrievalFields', description='The fields used for full-text search. Separate multiple fields with commas (,). These fields must be keys defined in Metadata.', example='title,content'),
  hnswEfConstruction?: string(name='HnswEfConstruction'),
  hnswM?: int32(name='HnswM', description='The maximum number of neighbors for the Hierarchical Navigable Small World (HNSW) algorithm. Valid values: 1 to 1000. In most cases, this parameter is automatically configured based on the value of the Dimension parameter. You do not need to configure this parameter.

>  We recommend that you configure this parameter based on the value of the Dimension parameter.

*If you set Dimension to a value less than or equal to 384, set the value of HnswM to 16.

*If you set Dimension to a value greater than 384 and less than or equal to 768, set the value of HnswM to 32.

*If you set Dimension to a value greater than 768 and less than or equal to 1024, set the value of HnswM to 64.

*If you set Dimension to a value greater than 1024, set the value of HnswM to 128.', example='64'),
  managerAccount?: string(name='ManagerAccount', description='Name of the management account with rds_superuser permissions.

> You can create an account through the console -> Account Management, or by using the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) API.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  metadata?: string(name='Metadata', description='The metadata of the vector data, which is a JSON string in the MAP format. The key specifies the field name, and the value specifies the data type.

>  Supported data types:

*   For information about the supported data types, see [Data types](https://www.alibabacloud.com/help/zh/analyticdb/analyticdb-for-postgresql/developer-reference/data-types-1/).

*   The money data type is not supported.

**

**Warning** Reserved fields such as id, vector, to_tsvector, and source cannot be used.

This parameter is required.', example='{"title":"text","content":"text","response":"int"}'),
  metadataIndices?: string(name='MetadataIndices', description='The scalar index fields. Separate multiple fields with commas (,). These fields must be keys defined in Metadata.', example='title'),
  metrics?: string(name='Metrics', description='The method that is used to create vector indexes. Valid values:

*   l2: Euclidean distance.
*   ip: inner product distance.
*   cosine: cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  parser?: string(name='Parser', description='The analyzer that is used for full-text search.', example='zh_cn'),
  pqEnable?: int32(name='PqEnable', description='Specifies whether to enable the product quantization (PQ) feature for index acceleration. We recommend that you enable this feature for more than 500,000 rows of data. Valid values:

*   0: no.
*   1 (default): yes.', example='0'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  sparseVectorIndexConfigShrink?: string(name='SparseVectorIndexConfig'),
  supportSparse?: boolean(name='SupportSparse'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model CreateCollectionResponseBody = {
  message?: string(name='Message', description='The returned message.', example='create successfully'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model CreateCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCollectionResponseBody(name='body'),
}

/**
 * @summary Creates a vector collection.
 *
 * @param tmpReq CreateCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCollectionResponse
 */
async function createCollectionWithOptions(tmpReq: CreateCollectionRequest, runtime: Util.RuntimeOptions): CreateCollectionResponse {
  Util.validateModel(tmpReq);
  var request = new CreateCollectionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sparseVectorIndexConfig)) {
    request.sparseVectorIndexConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sparseVectorIndexConfig, 'SparseVectorIndexConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dimension)) {
    query['Dimension'] = request.dimension;
  }
  if (!Util.isUnset(request.externalStorage)) {
    query['ExternalStorage'] = request.externalStorage;
  }
  if (!Util.isUnset(request.fullTextRetrievalFields)) {
    query['FullTextRetrievalFields'] = request.fullTextRetrievalFields;
  }
  if (!Util.isUnset(request.hnswEfConstruction)) {
    query['HnswEfConstruction'] = request.hnswEfConstruction;
  }
  if (!Util.isUnset(request.hnswM)) {
    query['HnswM'] = request.hnswM;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.metadata)) {
    query['Metadata'] = request.metadata;
  }
  if (!Util.isUnset(request.metadataIndices)) {
    query['MetadataIndices'] = request.metadataIndices;
  }
  if (!Util.isUnset(request.metrics)) {
    query['Metrics'] = request.metrics;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.parser)) {
    query['Parser'] = request.parser;
  }
  if (!Util.isUnset(request.pqEnable)) {
    query['PqEnable'] = request.pqEnable;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.sparseVectorIndexConfigShrink)) {
    query['SparseVectorIndexConfig'] = request.sparseVectorIndexConfigShrink;
  }
  if (!Util.isUnset(request.supportSparse)) {
    query['SupportSparse'] = request.supportSparse;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a vector collection.
 *
 * @param request CreateCollectionRequest
 * @return CreateCollectionResponse
 */
async function createCollection(request: CreateCollectionRequest): CreateCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCollectionWithOptions(request, runtime);
}

model CreateDBInstanceRequest {
  AINodeSpecInfos?: [ 
    {
      AINodeNum?: string(name='AINodeNum'),
      AINodeSpec?: string(name='AINodeSpec'),
    }
  ](name='AINodeSpecInfos'),
  backupId?: string(name='BackupId', description='Backup set ID.

> You can call the [DescribeDataBackups](https://help.aliyun.com/document_detail/210093.html) interface to view the backup set IDs of all backup sets under the target instance.', example='1111111111'),
  clientToken?: string(name='ClientToken', description='Idempotence check. For more information, see [How to Ensure Idempotence](https://help.aliyun.com/document_detail/327176.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  createSampleData?: boolean(name='CreateSampleData', description='Whether to load sample datasets after the instance is created. The values are as follows:

- **true**: Load sample datasets.
- **false**: Do not load sample datasets.

> If this parameter is not specified, it defaults to not loading sample datasets.', example='false'),
  DBInstanceCategory?: string(name='DBInstanceCategory', description='Instance series. The value description is as follows:

- **HighAvailability**: High availability version.
- **Basic**: Basic version.

> This parameter is required when creating an instance in the storage elastic mode.', example='HighAvailability'),
  DBInstanceClass?: string(name='DBInstanceClass', description='Instance type. For more details, see the supplementary description of the DBInstanceClass parameter.

> This parameter is required when creating a reserved storage mode instance.', example='gpdb.group.segsdx1'),
  DBInstanceDescription?: string(name='DBInstanceDescription', description='Instance description.', example='test'),
  DBInstanceGroupCount?: string(name='DBInstanceGroupCount', description='Number of compute groups. The values are: 2, 4, 8, 12, 16, 24, 32, 64, 96, 128.

> This parameter is required when creating a reserved storage mode instance.', example='2'),
  DBInstanceMode?: string(name='DBInstanceMode', description='Instance resource type. The value description is as follows:

- **StorageElastic**: Storage elastic mode.
- **Serverless**: Serverless mode.
- **Classic**: Storage reserved mode.

> This parameter is required.

This parameter is required.', example='StorageElastic'),
  deployMode?: string(name='DeployMode', description='Deployment mode. The values are as follows:
- multiple: Multi-zone deployment.
- single: Single-zone deployment.

> 
> - If this parameter is not specified, the default value is single-zone deployment.
> - Currently, only single-zone deployment is supported.', example='single'),
  enableSSL?: boolean(name='EnableSSL', description='Specifies whether to enable SSL encryption. Valid values:

*   **true**
*   **false** (default)', example='false'),
  encryptionKey?: string(name='EncryptionKey', description='Key ID.

> If the value of the **EncryptionType** parameter is **CloudDisk**, you need to specify the encryption key ID within the same region through this parameter; otherwise, it should be empty.', example='0d2470df-da7b-4786-b981-88888888****'),
  encryptionType?: string(name='EncryptionType', description='Encryption type. The value description is as follows:

- **NULL**: No encryption (default).
- **CloudDisk**: Enable cloud disk encryption and specify the key through the **EncryptionKey** parameter.

> Once cloud disk encryption is enabled, it cannot be disabled.', example='CloudDisk'),
  engine?: string(name='Engine', description='Database engine, with the value **gpdb**.

This parameter is required.', example='gpdb'),
  engineVersion?: string(name='EngineVersion', description='Engine version. The values are as follows:
- **6.0**: Version 6.0.
- **7.0**: Version 7.0.

This parameter is required.', example='6.0'),
  idleTime?: int32(name='IdleTime', description='The idle release wait time. When the duration without business traffic reaches the specified time, the instance will enter the idle state. The unit is seconds, with a minimum value of 60, and the default value is 600.

> This parameter is required only for Serverless auto-scheduling mode instances.', example='600'),
  instanceNetworkType?: string(name='InstanceNetworkType', description='Instance network type, with the value **VPC**.

> - Only VPC networks are supported in public cloud.
> - If not specified, it defaults to VPC type.', example='VPC'),
  instanceSpec?: string(name='InstanceSpec', description='Compute node specifications.

For high-availability versions of the elastic storage mode, the values are as follows:
- **2C16G**
- **4C32G**
- **16C128G**

For basic versions of the elastic storage mode, the values are as follows:
- **2C8G**
- **4C16G**
- **8C32G**
- **16C64G**

For Serverless mode, the values are as follows:
- **4C16G**
- **8C32G**

> This parameter is required when creating an elastic storage mode instance or a Serverless mode instance.', example='2C16G'),
  masterAISpec?: string(name='MasterAISpec', description='This parameter must be specified if you want to change coordinator nodes to AI coordinator nodes.

>-  You cannot specify the MasterAISpec and MasterCU parameters at the same time.
>- You can change coordinator nodes to AI coordinator nodes only in specific regions and zones.
>- Only AnalyticDB for PostgreSQL V7.0 instances of Basic Edition support AI coordinator nodes.
>- You can view the valid values of this parameter on the configuration change page of coordinator nodes.', example='ADB.AIMedium.2'),
  masterCU?: int32(name='MasterCU', description='Master resources, with the following values: 
- 2 CU 
- 4 CU 
- 8 CU 
- 16 CU 
- 32 CU 
> Master resources above 8 CU will incur charges.', example='8 CU'),
  masterNodeNum?: string(name='MasterNodeNum', description='This parameter is deprecated and should not be passed.', example='null'),
  ownerId?: long(name='OwnerId'),
  payType?: string(name='PayType', description='The billing method of the instance. Valid values:

*   **Postpaid**: pay-as-you-go.
*   **Prepaid**: subscription.

> 

*   If you do not specify this parameter, Postpaid is used.

*   You can obtain more cost savings if you create a subscription instance for one year or longer. We recommend that you select the billing method that best suits your needs.', example='Prepaid'),
  period?: string(name='Period', description='Unit of the duration for which resources are purchased. The values are as follows:
- **Month**: Month
- **Year**: Year

> This parameter is required when creating a subscription-billed instance.', example='Month'),
  privateIpAddress?: string(name='PrivateIpAddress', description='This parameter is deprecated and should not be passed.', example='null'),
  prodType?: string(name='ProdType', description='Product type. The values are as follows:
- **standard**: Standard Edition.
- **cost-effective**: Cost-Effective Edition.

> If this parameter is not specified, the default value is Standard Edition.', example='standard'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available region IDs.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the enterprise resource group where the instance is located.', example='rg-bp67acfmxazb4p****'),
  securityIPList?: string(name='SecurityIPList', description='The IP address whitelist of the instance.

A value of 127.0.0.1 denies access from any external IP address. You can call the [ModifySecurityIps](https://help.aliyun.com/document_detail/86928.html) operation to modify the IP address whitelist after you create an instance.', example='127.0.0.1'),
  segDiskPerformanceLevel?: string(name='SegDiskPerformanceLevel', description='The performance level of ESSDs. Valid values:

*   **pl0**
*   **pl1**
*   **pl2**

> 

*   This parameter takes effect only when SegStorageType is set to cloud_essd.

*   If you do not specify this parameter, pl1 is used.', example='pl1'),
  segNodeNum?: string(name='SegNodeNum', description='The number of compute nodes. The value description is as follows:

- For the high-availability version of the storage elastic mode, the value range is 4 to 512, and the value must be a multiple of 4.
- For the basic version of the storage elastic mode, the value range is 2 to 512, and the value must be a multiple of 2.
- For the Serverless mode, the value range is 2 to 512, and the value must be a multiple of 2.

> This parameter is required when creating instances in the storage elastic mode or Serverless mode.', example='4'),
  segStorageType?: string(name='SegStorageType', description='Disk storage type, currently only ESSD cloud disks are supported, with the value **cloud_essd**.

> This parameter is required when creating an elastic storage mode instance.', example='cloud_essd'),
  serverlessMode?: string(name='ServerlessMode', description='The mode of the Serverless instance. The values are as follows:

- **Manual**: Manual scheduling (default).
- **Auto**: Auto scheduling.

> This parameter is required only for Serverless mode instances.', example='Auto'),
  serverlessResource?: int32(name='ServerlessResource', description='The threshold for computing resources. The value range is 8 to 32, with a step of 8, and the unit is ACU. The default value is 32.

> This parameter is required only for Serverless auto-scheduling mode instances.', example='32'),
  srcDbInstanceName?: string(name='SrcDbInstanceName', description='ID of the source instance to be cloned.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) interface to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.', example='gp-bp***************'),
  standbyVSwitchId?: string(name='StandbyVSwitchId', description='VSwitch ID of the standby zone.

> 
> - This parameter is required for multi-zone deployment.
> - The VSwitch ID of the standby zone must be in the same zone as the StandbyZoneId.', example='vsw-bp1cpq8mr64paltkb****'),
  standbyZoneId?: string(name='StandbyZoneId', description='ID of the standby zone.

> 
> - This parameter is required for multi-zone deployment.
> - You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available zone IDs.
> - The ID of the standby zone must be different from the ID of the primary zone.', example='cn-hangzhou-j'),
  storageSize?: long(name='StorageSize', description='The size of the storage space, in GB, with a value range of <props="china">50~8000<props="intl">50~6000.

> This parameter is required when creating an instance in the storage elastic mode.', example='200'),
  storageType?: string(name='StorageType', description='This parameter is deprecated and should not be passed.', example='null'),
  tag?: [ 
    {
      key?: string(name='Key', description='Tag key. The restrictions are as follows:

- It cannot be an empty string.
- It supports up to 128 characters.
- It cannot start with `aliyun` or `acs:`, and it cannot contain `http://` or `https://`.', example='TestKey'),
      value?: string(name='Value', description='Tag value. The restrictions are as follows:

- It can be an empty string.
- It supports up to 128 characters.
- It cannot start with `acs:`, and it cannot contain `http://` or `https://`.', example='TestValue'),
    }
  ](name='Tag', description='The Nth tag. The value of N ranges from 1 to 20.'),
  usedTime?: string(name='UsedTime', description='Duration for which resources are purchased. The values are as follows:
- When **Period** is **Month**, the value ranges from 1 to 9.
- When **Period** is **Year**, the value ranges from 1 to 3.

> This parameter is required when creating a subscription-billed instance.', example='1'),
  VPCId?: string(name='VPCId', description='VPC ID.

> - **VPCId** is required.
> - The region of the **VPC** must be consistent with **RegionId**.', example='vpc-bp19ame5m1r3oejns****'),
  vSwitchId?: string(name='VSwitchId', description='vSwitch ID.

> - **vSwitchId** is required.
> - The availability zone of the **vSwitch** must be consistent with **ZoneId**.', example='vsw-bp1cpq8mr64paltkb****'),
  vectorConfigurationStatus?: string(name='VectorConfigurationStatus', description='Whether to enable vector engine optimization. The value description is as follows:
- **enabled**: Enable vector engine optimization.
- **disabled** (default): Do not enable vector engine optimization.

> - For mainstream analysis scenarios, data warehouse scenarios, and real-time data warehouse scenarios, it is recommended to **not enable** vector engine optimization.
> - For users using the vector analysis engine for AIGC, vector retrieval, and other scenarios, it is recommended to **enable** vector engine optimization.', example='enabled'),
  zoneId?: string(name='ZoneId', description='Zone ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available zone IDs.

This parameter is required.', example='cn-hangzhou-i'),
}

model CreateDBInstanceResponseBody = {
  connectionString?: string(name='ConnectionString', description='This parameter is deprecated and will not return a value.

You can use the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/86910.html) interface to view the connection address of the instance.', example='gp-bp12ga6v69h86****.gpdb.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.', example='gp-bp12ga6v69h86****'),
  orderId?: string(name='OrderId', description='Order ID.', example='111111111111'),
  port?: string(name='Port', description='This parameter is deprecated and will not return a value.

You can use the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/86910.html) interface to view the port number of the instance.', example='3432'),
  requestId?: string(name='RequestId', description='Request ID.', example='5414A4E5-4C36-4461-95FC-************'),
}

model CreateDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDBInstanceResponseBody(name='body'),
}

/**
 * @summary Create Instance
 *
 * @description Before using this interface, please make sure you have fully understood the [billing method](https://help.aliyun.com/document_detail/35406.html) and <props="china">[pricing](https://www.aliyun.com/price/product#/gpdb/detail/GreenplumPost)<props="intl">[pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing) of the AnalyticDB for PostgreSQL product.
 *
 * @param request CreateDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDBInstanceResponse
 */
async function createDBInstanceWithOptions(request: CreateDBInstanceRequest, runtime: Util.RuntimeOptions): CreateDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.AINodeSpecInfos)) {
    query['AINodeSpecInfos'] = request.AINodeSpecInfos;
  }
  if (!Util.isUnset(request.backupId)) {
    query['BackupId'] = request.backupId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.createSampleData)) {
    query['CreateSampleData'] = request.createSampleData;
  }
  if (!Util.isUnset(request.DBInstanceCategory)) {
    query['DBInstanceCategory'] = request.DBInstanceCategory;
  }
  if (!Util.isUnset(request.DBInstanceClass)) {
    query['DBInstanceClass'] = request.DBInstanceClass;
  }
  if (!Util.isUnset(request.DBInstanceDescription)) {
    query['DBInstanceDescription'] = request.DBInstanceDescription;
  }
  if (!Util.isUnset(request.DBInstanceGroupCount)) {
    query['DBInstanceGroupCount'] = request.DBInstanceGroupCount;
  }
  if (!Util.isUnset(request.DBInstanceMode)) {
    query['DBInstanceMode'] = request.DBInstanceMode;
  }
  if (!Util.isUnset(request.deployMode)) {
    query['DeployMode'] = request.deployMode;
  }
  if (!Util.isUnset(request.enableSSL)) {
    query['EnableSSL'] = request.enableSSL;
  }
  if (!Util.isUnset(request.encryptionKey)) {
    query['EncryptionKey'] = request.encryptionKey;
  }
  if (!Util.isUnset(request.encryptionType)) {
    query['EncryptionType'] = request.encryptionType;
  }
  if (!Util.isUnset(request.engine)) {
    query['Engine'] = request.engine;
  }
  if (!Util.isUnset(request.engineVersion)) {
    query['EngineVersion'] = request.engineVersion;
  }
  if (!Util.isUnset(request.idleTime)) {
    query['IdleTime'] = request.idleTime;
  }
  if (!Util.isUnset(request.instanceNetworkType)) {
    query['InstanceNetworkType'] = request.instanceNetworkType;
  }
  if (!Util.isUnset(request.instanceSpec)) {
    query['InstanceSpec'] = request.instanceSpec;
  }
  if (!Util.isUnset(request.masterAISpec)) {
    query['MasterAISpec'] = request.masterAISpec;
  }
  if (!Util.isUnset(request.masterCU)) {
    query['MasterCU'] = request.masterCU;
  }
  if (!Util.isUnset(request.masterNodeNum)) {
    query['MasterNodeNum'] = request.masterNodeNum;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.privateIpAddress)) {
    query['PrivateIpAddress'] = request.privateIpAddress;
  }
  if (!Util.isUnset(request.prodType)) {
    query['ProdType'] = request.prodType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.securityIPList)) {
    query['SecurityIPList'] = request.securityIPList;
  }
  if (!Util.isUnset(request.segDiskPerformanceLevel)) {
    query['SegDiskPerformanceLevel'] = request.segDiskPerformanceLevel;
  }
  if (!Util.isUnset(request.segNodeNum)) {
    query['SegNodeNum'] = request.segNodeNum;
  }
  if (!Util.isUnset(request.segStorageType)) {
    query['SegStorageType'] = request.segStorageType;
  }
  if (!Util.isUnset(request.serverlessMode)) {
    query['ServerlessMode'] = request.serverlessMode;
  }
  if (!Util.isUnset(request.serverlessResource)) {
    query['ServerlessResource'] = request.serverlessResource;
  }
  if (!Util.isUnset(request.srcDbInstanceName)) {
    query['SrcDbInstanceName'] = request.srcDbInstanceName;
  }
  if (!Util.isUnset(request.standbyVSwitchId)) {
    query['StandbyVSwitchId'] = request.standbyVSwitchId;
  }
  if (!Util.isUnset(request.standbyZoneId)) {
    query['StandbyZoneId'] = request.standbyZoneId;
  }
  if (!Util.isUnset(request.storageSize)) {
    query['StorageSize'] = request.storageSize;
  }
  if (!Util.isUnset(request.storageType)) {
    query['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  if (!Util.isUnset(request.VPCId)) {
    query['VPCId'] = request.VPCId;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  if (!Util.isUnset(request.vectorConfigurationStatus)) {
    query['VectorConfigurationStatus'] = request.vectorConfigurationStatus;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create Instance
 *
 * @description Before using this interface, please make sure you have fully understood the [billing method](https://help.aliyun.com/document_detail/35406.html) and <props="china">[pricing](https://www.aliyun.com/price/product#/gpdb/detail/GreenplumPost)<props="intl">[pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing) of the AnalyticDB for PostgreSQL product.
 *
 * @param request CreateDBInstanceRequest
 * @return CreateDBInstanceResponse
 */
async function createDBInstance(request: CreateDBInstanceRequest): CreateDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDBInstanceWithOptions(request, runtime);
}

model CreateDBInstancePlanRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  planConfig?: string(name='PlanConfig', description='The execution information of the plan. Specify the parameter in the JSON format. The parameter value varies based on the values of **PlanType** and **PlanScheduleType**. The following section describes the PlanConfig parameter.

This parameter is required.', example='{"pause":{"planCronTime":"0 0 12 1/1 * ? "},"resume":{"planCronTime":"0 0 0 1/1 * ? "}}'),
  planDesc?: string(name='PlanDesc', description='The description of the plan.', example='this is a test plan'),
  planEndDate?: string(name='PlanEndDate', description='The end time of the plan. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time must be in UTC. The end time must be later than the start time.

> 

*   This parameter must be specified only when **PlanScheduleType** is set to **Regular**.

*   If you do not specify this parameter, the plan stops until the plan is deleted.', example='2023-04-17T23:00Z'),
  planName?: string(name='PlanName', description='The name of the plan.

This parameter is required.', example='test-plan'),
  planScheduleType?: string(name='PlanScheduleType', description='The execution mode of the plan. Valid values:

*   **Postpone**: The plan is executed later.
*   **Regular**: The plan is executed periodically.

This parameter is required.', example='Regular'),
  planStartDate?: string(name='PlanStartDate', description='The start time of the plan. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time must be in UTC.

> 

*   This parameter must be specified only when **PlanScheduleType** is set to **Regular**.

*   If you do not specify this parameter, the current time is used.', example='2022-04-17T23:00Z'),
  planType?: string(name='PlanType', description='The type of the plan. Valid values:

*   **PauseResume**: pauses and resumes an instance.
*   **Resize**: changes the number of compute nodes.
*   **ModifySpec**: changes compute node specifications.

> - You can specify the value to ModifySpec only for instances in elastic storage mode.
>- You can specify the value to ModifySpec only for instances in elastic storage mode.

This parameter is required.', example='PauseResume'),
}

model CreateDBInstancePlanResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message.

This parameter is returned only if the request fails.', example='****'),
  planId?: string(name='PlanId', description='The plan ID.', example='1234'),
  requestId?: string(name='RequestId', description='The request ID.', example='34b32a0a-08ef-4a87-b6be-cdd9f56fc3ad'),
  status?: string(name='Status', description='Indicates whether the request was successful.

If the request was successful, **success** is returned. If the request failed, this parameter is not returned.', example='success'),
}

model CreateDBInstancePlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDBInstancePlanResponseBody(name='body'),
}

/**
 * @summary Creates a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   The plan management feature is supported only for pay-as-you-go instances.
 * *   When you change the compute node specifications or change the number of compute nodes, transient connections may occur. We recommend that you perform these operations during off-peak hours.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request CreateDBInstancePlanRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDBInstancePlanResponse
 */
async function createDBInstancePlanWithOptions(request: CreateDBInstancePlanRequest, runtime: Util.RuntimeOptions): CreateDBInstancePlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.planConfig)) {
    query['PlanConfig'] = request.planConfig;
  }
  if (!Util.isUnset(request.planDesc)) {
    query['PlanDesc'] = request.planDesc;
  }
  if (!Util.isUnset(request.planEndDate)) {
    query['PlanEndDate'] = request.planEndDate;
  }
  if (!Util.isUnset(request.planName)) {
    query['PlanName'] = request.planName;
  }
  if (!Util.isUnset(request.planScheduleType)) {
    query['PlanScheduleType'] = request.planScheduleType;
  }
  if (!Util.isUnset(request.planStartDate)) {
    query['PlanStartDate'] = request.planStartDate;
  }
  if (!Util.isUnset(request.planType)) {
    query['PlanType'] = request.planType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDBInstancePlan',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   The plan management feature is supported only for pay-as-you-go instances.
 * *   When you change the compute node specifications or change the number of compute nodes, transient connections may occur. We recommend that you perform these operations during off-peak hours.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request CreateDBInstancePlanRequest
 * @return CreateDBInstancePlanResponse
 */
async function createDBInstancePlan(request: CreateDBInstancePlanRequest): CreateDBInstancePlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDBInstancePlanWithOptions(request, runtime);
}

model CreateDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupConfig?: string(name='ResourceGroupConfig', description='The configurations of the resource group.

> 

*   CpuRateLimit: the percentage of CPU resources that are available for the resource group. Unit: %.

*   MemoryLimit: the percentage of memory resources that are available for the resource group. Unit: %.

*   MemorySharedQuota: the percentage of memory resources shared among transactions that are submitted to the resource group. Unit: %. Default value: 80.

*   MemorySpillRatio: the memory spill ratio for memory-intensive transactions. When the memory that is used by memory-intensive transactions reaches this value, data is spilled to disks. Unit: %. Default value: 0.

*   Concurrency: the maximum number of concurrent transactions or parallel queries that are allowed for a resource group. Default value: 20.

This parameter is required.', example='{"CpuRateLimit":"10","MemoryLimit":"12","MemorySharedQuota":"20","MemorySpillRatio":"75","Concurrency":"3"}'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
}

model CreateDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model CreateDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Creates a resource group.
 *
 * @param request CreateDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDBResourceGroupResponse
 */
async function createDBResourceGroupWithOptions(request: CreateDBResourceGroupRequest, runtime: Util.RuntimeOptions): CreateDBResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupConfig)) {
    query['ResourceGroupConfig'] = request.resourceGroupConfig;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a resource group.
 *
 * @param request CreateDBResourceGroupRequest
 * @return CreateDBResourceGroupResponse
 */
async function createDBResourceGroup(request: CreateDBResourceGroupRequest): CreateDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDBResourceGroupWithOptions(request, runtime);
}

model CreateDocumentCollectionRequest {
  collection?: string(name='Collection', description='The name of the document collection that you want to create.

> The name must comply with PostgreSQL object naming restrictions.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  dimension?: int32(name='Dimension'),
  embeddingModel?: string(name='EmbeddingModel', description='The vectorization algorithm.

>  Supported algorithms:

*   text-embedding-v1: the algorithm that produces 1536-dimensional vectors.

*   text-embedding-v2: the algorithm that produces 1536-dimensional vectors.

*   text2vec: the algorithm that produces 1024-dimensional vectors.

*   m3e-base: the algorithm that produces 768-dimensional vectors.

*   m3e-small: the algorithm that produces 512-dimensional vectors.

*   clip-vit-b-32: the image vectorization algorithm that uses the Contrastive Language-Image Pre-Training (CLIP) ViT-B/32 model and produces 512-dimensional vectors.

*   clip-vit-b-16: the image vectorization algorithm that uses the CLIP ViT-B/16 model and produces 512-dimensional vectors.

*   clip-vit-l-14: the image vectorization algorithm that uses the CLIP ViT-L/14 model and produces 768-dimensional vectors.

*   clip-vit-l-14-336px: the image vectorization algorithm that uses the CLIP ViT-L/14@336px model and produces 768-dimensional vectors.

*   clip-rn50: the image vectorization algorithm that uses the CLIP RN50 model and produces 1024-dimensional vectors.

*   clip-rn101: the image vectorization algorithm that uses the CLIP RN101 model and produces 512-dimensional vectors.

*   clip-rn50x4: the image vectorization algorithm that uses the CLIP RN50x4 model and produces 640-dimensional vectors.

*   clip-rn50x16: the image vectorization algorithm that uses the CLIP RN50x16 model and produces 768-dimensional vectors.

*   clip-rn50x64: the image vectorization algorithm that uses the CLIP RN50x64 model and produces 1024-dimensional vectors.', example='text-embedding-v1'),
  externalStorage?: int32(name='ExternalStorage', description='Specifies whether to use the memory mapping technology to create HNSW indexes. Valid values: 0 and 1. Default value: 0. We recommend that you set the value to 1 in scenarios that require upload speed but not data deletion.

> 

*   0: uses segmented paging storage to create indexes. This method uses the shared buffer of PostgreSQL for caching and supports the delete and update operations.

*   1: uses the memory mapping technology to create indexes. This method does not support the delete or update operation.', example='0'),
  fullTextRetrievalFields?: string(name='FullTextRetrievalFields', description='The fields used for full-text search. Separate multiple fields with commas (,). These fields must be keys defined in Metadata.', example='title,page'),
  hnswEfConstruction?: string(name='HnswEfConstruction'),
  hnswM?: int32(name='HnswM', description='The maximum number of neighbors for the Hierarchical Navigable Small World (HNSW) algorithm. Valid values: 1 to 1000. In most cases, this parameter is automatically configured based on the value of the Dimension parameter. You do not need to configure this parameter.

>  We recommend that you configure this parameter based on the value of the Dimension parameter.

*   If you set Dimension to a value less than or equal to 384, set the value of HnswM to 16.

*   If you set Dimension to a value greater than 384 and less than or equal to 768, set the value of HnswM to 32.

*   If you set Dimension to a value greater than 768 and less than or equal to 1024, set the value of HnswM to 64.

*   If you set Dimension to a value greater than 1024, set the value of HnswM to 128.', example='64'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

> You can create an account through the console -> Account Management, or by using the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) API.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the management account.

This parameter is required.', example='testpassword'),
  metadata?: string(name='Metadata', description='The metadata of the vector data, which is a JSON string in the MAP format. The key specifies the field name, and the value specifies the data type.

> Supported data types:
> - For information about data types, see: [Data Types](https://www.alibabacloud.com/help/en/analyticdb/analyticdb-for-postgresql/developer-reference/data-types-1/).
> - The money type is not supported.

>Warning: The fields id, vector, doc_name, content, loader_metadata, source, and to_tsvector are reserved and should not be used.', example='{"title":"text","page":"int"}'),
  metadataIndices?: string(name='MetadataIndices', example='title'),
  metrics?: string(name='Metrics', description='The method that is used to create vector indexes.

Valid values:

*   **l2**: Euclidean distance.
*   **ip**: inner product distance.
*   **cosine** (default): cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  parser?: string(name='Parser', description='The analyzer that is used for full-text search. Default value: zh_cn.', example='zh_cn'),
  pqEnable?: int32(name='PqEnable', description='Specifies whether to enable the product quantization (PQ) feature for index acceleration. We recommend that you enable this feature for more than 500,000 rows of data. Valid values:

*   0: no.
*   1 (default): yes.', example='1'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model CreateDocumentCollectionResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:
- **success**
- **fail**', example='successs'),
}

model CreateDocumentCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDocumentCollectionResponseBody(name='body'),
}

/**
 * @summary Creates a document collection.
 *
 * @param request CreateDocumentCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDocumentCollectionResponse
 */
async function createDocumentCollectionWithOptions(request: CreateDocumentCollectionRequest, runtime: Util.RuntimeOptions): CreateDocumentCollectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dimension)) {
    query['Dimension'] = request.dimension;
  }
  if (!Util.isUnset(request.embeddingModel)) {
    query['EmbeddingModel'] = request.embeddingModel;
  }
  if (!Util.isUnset(request.externalStorage)) {
    query['ExternalStorage'] = request.externalStorage;
  }
  if (!Util.isUnset(request.fullTextRetrievalFields)) {
    query['FullTextRetrievalFields'] = request.fullTextRetrievalFields;
  }
  if (!Util.isUnset(request.hnswEfConstruction)) {
    query['HnswEfConstruction'] = request.hnswEfConstruction;
  }
  if (!Util.isUnset(request.hnswM)) {
    query['HnswM'] = request.hnswM;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.metadata)) {
    query['Metadata'] = request.metadata;
  }
  if (!Util.isUnset(request.metadataIndices)) {
    query['MetadataIndices'] = request.metadataIndices;
  }
  if (!Util.isUnset(request.metrics)) {
    query['Metrics'] = request.metrics;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.parser)) {
    query['Parser'] = request.parser;
  }
  if (!Util.isUnset(request.pqEnable)) {
    query['PqEnable'] = request.pqEnable;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDocumentCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a document collection.
 *
 * @param request CreateDocumentCollectionRequest
 * @return CreateDocumentCollectionResponse
 */
async function createDocumentCollection(request: CreateDocumentCollectionRequest): CreateDocumentCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDocumentCollectionWithOptions(request, runtime);
}

model CreateExtensionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-xxxxxxxxx'),
  DBNames?: string(name='DBNames', description='The name of the database.

This parameter is required.', example='demo1'),
  extensions?: string(name='Extensions', description='The name of the extension that you want to install. Separate multiple extension names with commas (,).

This parameter is required.', example='citext, dblink'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model CreateExtensionsResponseBody = {
  extensions?: string(name='Extensions', description='The name of the extension that you want to install. Multiple extension names are separated with commas (,).', example='citext, dblink'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model CreateExtensionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateExtensionsResponseBody(name='body'),
}

/**
 * @summary Install extensions.
 *
 * @param request CreateExtensionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateExtensionsResponse
 */
async function createExtensionsWithOptions(request: CreateExtensionsRequest, runtime: Util.RuntimeOptions): CreateExtensionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.DBNames)) {
    query['DBNames'] = request.DBNames;
  }
  if (!Util.isUnset(request.extensions)) {
    query['Extensions'] = request.extensions;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateExtensions',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Install extensions.
 *
 * @param request CreateExtensionsRequest
 * @return CreateExtensionsResponse
 */
async function createExtensions(request: CreateExtensionsRequest): CreateExtensionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return createExtensionsWithOptions(request, runtime);
}

model CreateExternalDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', description='Region ID, you can view available region IDs through the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface.', example='cn-beijing'),
  serviceDescription?: string(name='ServiceDescription', description='Service description.', example='pxf test'),
  serviceName?: string(name='ServiceName', description='Service name.

This parameter is required.', example='test-adbpgss'),
  serviceSpec?: string(name='ServiceSpec', description='Service specification (in CU), value:

- 8

This parameter is required.', example='8'),
}

model CreateExternalDataServiceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceId?: int32(name='ServiceId', description='Service ID.', example='100'),
}

model CreateExternalDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateExternalDataServiceResponseBody(name='body'),
}

/**
 * @summary Create External Data Service
 *
 * @param request CreateExternalDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateExternalDataServiceResponse
 */
async function createExternalDataServiceWithOptions(request: CreateExternalDataServiceRequest, runtime: Util.RuntimeOptions): CreateExternalDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceDescription)) {
    query['ServiceDescription'] = request.serviceDescription;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.serviceSpec)) {
    query['ServiceSpec'] = request.serviceSpec;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateExternalDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Service
 *
 * @param request CreateExternalDataServiceRequest
 * @return CreateExternalDataServiceResponse
 */
async function createExternalDataService(request: CreateExternalDataServiceRequest): CreateExternalDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createExternalDataServiceWithOptions(request, runtime);
}

model CreateHadoopDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Service description.', example='pxf for hdfs data source'),
  dataSourceName?: string(name='DataSourceName', description='Service name.', example='hdfs_pxf'),
  dataSourceType?: string(name='DataSourceType', description='Type of Hadoop external table to be enabled, with values:

- HDFS 

- Hive', example='HDFS'),
  emrInstanceId?: string(name='EmrInstanceId', description='When HadoopCreateType=Emr, this field should contain the EMR instance ID.', example='c-1234567'),
  HDFSConf?: string(name='HDFSConf', description='Content string of the Hadoop hdfs-site.xml file. This field is required when enabling an HDFS external table.', example='<?xml version="1.0" ?>
<!-- Created at 2023-08-15 13:52:43.945 -->
<configuration>
    <property>
        <name>dfs.datanode.cache.revocation.timeout.ms</name>
        <value>900000</value>
    </property>
    <property>
        <name>dfs.namenode.resource.check.interval</name>
        <value>5000</value>
    </property>
</configuration>'),
  hadoopCoreConf?: string(name='HadoopCoreConf', description='Content string of the Hadoop core-site.xml file.', example='<?xml version="1.0" ?>
<!-- Created at 2023-08-15 13:52:39.527 -->
<configuration>
    <property>
        <name>hadoop.http.authentication.kerberos.keytab</name>
        <value>/etc/emr/hadoop-conf/http.keytab</value>
    </property>
    <property>
        <name>fs.oss.idle.timeout.millisecond</name>
        <value>30000</value>
    </property>
    <property>
        <name>fs.oss.download.thread.concurrency</name>
        <value>32</value>
    </property>
</configuration>'),
  hadoopCreateType?: string(name='HadoopCreateType', description='External service type:

- emr

- hadoop: Self-built Hadoop', example='emr'),
  hadoopHostsAddress?: string(name='HadoopHostsAddress', description='Address and hostname of the Hadoop cluster\\\\"s source node in the /etc/hosts file.', example='192.168.220.128 master-1-1.c-xxx.cn-shanghai.emr.aliyuncs.com
192.168.220.129 core-1-1.c-xxx.cn-shanghai.emr.aliyuncs.com
192.168.220.130 core-1-2.c-xxx.cn-shanghai.emr.aliyuncs.com'),
  hiveConf?: string(name='HiveConf', description='Content string of the Hadoop hive-site.xml file. This field is required when enabling a HIVE external table.', example='<?xml version="1.0" ?>
<!-- Created at 2023-08-15 13:52:50.646 -->
<configuration>
    <property>
        <name>hive.exec.reducers.bytes.per.reducer</name>
        <value>256000000</value>
    </property>
    <property>
        <name>hive.stats.column.autogather</name>
        <value>false</value>
    </property>
</configuration>'),
  mapReduceConf?: string(name='MapReduceConf', description='Content string of the Hadoop mapred-site.xml file. This field is required when enabling an HDFS external table.', example='xxxxxx'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available region IDs.', example='cn-hangzhou'),
  yarnConf?: string(name='YarnConf', description='Content string of the Hadoop yarn-site.xml file. This field is required when enabling an HDFS external table.', example='<?xml version="1.0" ?>
<!-- Created at 2023-08-15 13:53:29.021 -->
<configuration>
    <property>
        <name>yarn.nodemanager.linux-container-executor.nonsecure-mode.local-user</name>
        <value>hadoop</value>
    </property>
    <property>
        <name>yarn.scheduler.fair.dynamic.max.assign</name>
        <value>true</value>
    </property>
</configuration>'),
}

model CreateHadoopDataSourceResponseBody = {
  dataSourceId?: int32(name='DataSourceId', description='Data source ID.', example='123'),
  requestId?: string(name='RequestId', description='Request ID.', example='2C125605-266F-41CA-8AC5-3A643D4F42C5'),
}

model CreateHadoopDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHadoopDataSourceResponseBody(name='body'),
}

/**
 * @summary Create Hadoop data source configuration
 *
 * @param request CreateHadoopDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHadoopDataSourceResponse
 */
async function createHadoopDataSourceWithOptions(request: CreateHadoopDataSourceRequest, runtime: Util.RuntimeOptions): CreateHadoopDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceName)) {
    query['DataSourceName'] = request.dataSourceName;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    query['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.emrInstanceId)) {
    query['EmrInstanceId'] = request.emrInstanceId;
  }
  if (!Util.isUnset(request.HDFSConf)) {
    query['HDFSConf'] = request.HDFSConf;
  }
  if (!Util.isUnset(request.hadoopCoreConf)) {
    query['HadoopCoreConf'] = request.hadoopCoreConf;
  }
  if (!Util.isUnset(request.hadoopCreateType)) {
    query['HadoopCreateType'] = request.hadoopCreateType;
  }
  if (!Util.isUnset(request.hadoopHostsAddress)) {
    query['HadoopHostsAddress'] = request.hadoopHostsAddress;
  }
  if (!Util.isUnset(request.hiveConf)) {
    query['HiveConf'] = request.hiveConf;
  }
  if (!Util.isUnset(request.mapReduceConf)) {
    query['MapReduceConf'] = request.mapReduceConf;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.yarnConf)) {
    query['YarnConf'] = request.yarnConf;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateHadoopDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create Hadoop data source configuration
 *
 * @param request CreateHadoopDataSourceRequest
 * @return CreateHadoopDataSourceResponse
 */
async function createHadoopDataSource(request: CreateHadoopDataSourceRequest): CreateHadoopDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createHadoopDataSourceWithOptions(request, runtime);
}

model CreateIndexRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  indexConfig?: string(name='IndexConfig'),
  indexField?: string(name='IndexField', example='title'),
  indexName?: string(name='IndexName', example='testindex'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model CreateIndexResponseBody = {
  jobId?: string(name='JobId', example='231460f8-75dc-405e-a669-0c5204887e91'),
  message?: string(name='Message', example='Successfully create job'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model CreateIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateIndexResponseBody(name='body'),
}

/**
 * @summary 创建索引
 *
 * @param request CreateIndexRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateIndexResponse
 */
async function createIndexWithOptions(request: CreateIndexRequest, runtime: Util.RuntimeOptions): CreateIndexResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.indexConfig)) {
    query['IndexConfig'] = request.indexConfig;
  }
  if (!Util.isUnset(request.indexField)) {
    query['IndexField'] = request.indexField;
  }
  if (!Util.isUnset(request.indexName)) {
    query['IndexName'] = request.indexName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateIndex',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建索引
 *
 * @param request CreateIndexRequest
 * @return CreateIndexResponse
 */
async function createIndex(request: CreateIndexRequest): CreateIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  return createIndexWithOptions(request, runtime);
}

model CreateJDBCDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Data source description.', example='test'),
  dataSourceName?: string(name='DataSourceName', description='The name of data soruce', example='jdbc_pxf'),
  dataSourceType?: string(name='DataSourceType', description='The type of the data source.', example='mysql'),
  JDBCConnectionString?: string(name='JDBCConnectionString', description='The JDBC connection string.', example='xxxxxx'),
  JDBCPassword?: string(name='JDBCPassword', description='The password of the database account.', example='xxxxxx'),
  JDBCUserName?: string(name='JDBCUserName', description='The name of the database account.', example='xxxxxx'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
}

model CreateJDBCDataSourceResponseBody = {
  dataSourceId?: string(name='DataSourceId', description='Data source ID.', example='123'),
  requestId?: string(name='RequestId', description='The request ID.', example='2C125605-266F-41CA-8AC5-3A643D4F42C5'),
}

model CreateJDBCDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateJDBCDataSourceResponseBody(name='body'),
}

/**
 * @summary Creates a JDBC data source.
 *
 * @param request CreateJDBCDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateJDBCDataSourceResponse
 */
async function createJDBCDataSourceWithOptions(request: CreateJDBCDataSourceRequest, runtime: Util.RuntimeOptions): CreateJDBCDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceName)) {
    query['DataSourceName'] = request.dataSourceName;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    query['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.JDBCConnectionString)) {
    query['JDBCConnectionString'] = request.JDBCConnectionString;
  }
  if (!Util.isUnset(request.JDBCPassword)) {
    query['JDBCPassword'] = request.JDBCPassword;
  }
  if (!Util.isUnset(request.JDBCUserName)) {
    query['JDBCUserName'] = request.JDBCUserName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateJDBCDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a JDBC data source.
 *
 * @param request CreateJDBCDataSourceRequest
 * @return CreateJDBCDataSourceResponse
 */
async function createJDBCDataSource(request: CreateJDBCDataSourceRequest): CreateJDBCDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createJDBCDataSourceWithOptions(request, runtime);
}

model CreateNamespaceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  namespace?: string(name='Namespace', description='The name of the namespace. After the namespace is created, the system automatically creates an account that has the same name.

>  The name must comply with the naming conventions of PostgreSQL objects.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword2'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model CreateNamespaceResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model CreateNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateNamespaceResponseBody(name='body'),
}

/**
 * @summary Creates a vector namespace.
 *
 * @param request CreateNamespaceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateNamespaceResponse
 */
async function createNamespaceWithOptions(request: CreateNamespaceRequest, runtime: Util.RuntimeOptions): CreateNamespaceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateNamespace',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a vector namespace.
 *
 * @param request CreateNamespaceRequest
 * @return CreateNamespaceResponse
 */
async function createNamespace(request: CreateNamespaceRequest): CreateNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createNamespaceWithOptions(request, runtime);
}

model CreateRemoteADBDataSourceRequest {
  dataSourceName?: string(name='DataSourceName', description='Customer-specified DataSourceName.', example='test'),
  localDBInstanceId?: string(name='LocalDBInstanceId', description='Instance ID of the data being used (required).

This parameter is required.', example='gp-test1'),
  localDatabase?: string(name='LocalDatabase', description='Database name of the data being used (required)

This parameter is required.', example='db1'),
  managerUserName?: string(name='ManagerUserName', description='Management account of the data-using instance.

This parameter is required.', example='managerAccount'),
  managerUserPassword?: string(name='ManagerUserPassword', description='Password of the management account of the data-using instance.

This parameter is required.', example='password2'),
  ownerId?: long(name='OwnerId'),
  remoteDBInstanceId?: string(name='RemoteDBInstanceId', description='Instance ID providing the data (required).

This parameter is required.', example='gp-test2'),
  remoteDatabase?: string(name='RemoteDatabase', description='Database name providing the data (required).

This parameter is required.', example='db2'),
  userName?: string(name='UserName', description='Account name of the data-providing instance used for user mapping (required).

This parameter is required.', example='account1'),
  userPassword?: string(name='UserPassword', description='Password of the data-providing instance account used for user mapping.

This parameter is required.', example='password1'),
}

model CreateRemoteADBDataSourceResponseBody = {
  dataSourceItem?: {
    dataSourceName?: string(name='DataSourceName', description='Data source name.', example='db1_gptest1_to_db2_gp-test2'),
    description?: string(name='Description', description='Description information.', example='userName'),
    id?: long(name='Id', description='ID', example='1'),
    localDatabase?: string(name='LocalDatabase', description='Local database name', example='db1'),
    localInstanceName?: string(name='LocalInstanceName', description='Local instance name', example='gp-test1'),
    managerUserName?: string(name='ManagerUserName', description='Management account user name', example='manager_user'),
    regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
    remoteDatabase?: string(name='RemoteDatabase', description='Remote database name', example='db2'),
    remoteInstanceName?: string(name='RemoteInstanceName', description='Remote instance name', example='gp-test2'),
    status?: string(name='Status', description='Synchronization status', example='creating'),
    userName?: string(name='UserName', description='User name', example='user1'),
  }(name='DataSourceItem', description='Returns the successfully added data sharing service data.'),
  requestId?: string(name='RequestId', description='Request ID.', example='e9d60eb1-e90d-4bc6-a470-c8b767460858'),
  taskId?: int32(name='TaskId', description='Workflow task ID.', example='90000'),
}

model CreateRemoteADBDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateRemoteADBDataSourceResponseBody(name='body'),
}

/**
 * @summary Create Homogeneous Data Source
 *
 * @param request CreateRemoteADBDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRemoteADBDataSourceResponse
 */
async function createRemoteADBDataSourceWithOptions(request: CreateRemoteADBDataSourceRequest, runtime: Util.RuntimeOptions): CreateRemoteADBDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dataSourceName)) {
    query['DataSourceName'] = request.dataSourceName;
  }
  if (!Util.isUnset(request.localDBInstanceId)) {
    query['LocalDBInstanceId'] = request.localDBInstanceId;
  }
  if (!Util.isUnset(request.localDatabase)) {
    query['LocalDatabase'] = request.localDatabase;
  }
  if (!Util.isUnset(request.managerUserName)) {
    query['ManagerUserName'] = request.managerUserName;
  }
  if (!Util.isUnset(request.managerUserPassword)) {
    query['ManagerUserPassword'] = request.managerUserPassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.remoteDBInstanceId)) {
    query['RemoteDBInstanceId'] = request.remoteDBInstanceId;
  }
  if (!Util.isUnset(request.remoteDatabase)) {
    query['RemoteDatabase'] = request.remoteDatabase;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  if (!Util.isUnset(request.userPassword)) {
    query['UserPassword'] = request.userPassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRemoteADBDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create Homogeneous Data Source
 *
 * @param request CreateRemoteADBDataSourceRequest
 * @return CreateRemoteADBDataSourceResponse
 */
async function createRemoteADBDataSource(request: CreateRemoteADBDataSourceRequest): CreateRemoteADBDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRemoteADBDataSourceWithOptions(request, runtime);
}

model CreateSampleDataRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/2361776.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model CreateSampleDataResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned if an error occurs. This message does not affect the execution of the operation.', example='*********'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='15A6881F-AAAB-5E4D-9B3F-6DCC1BDF4F2E_99'),
  status?: boolean(name='Status', description='The execution state of the operation. Valid values:

*   **false**: The operation fails.
*   **true**: The operation is successful.', example='true'),
}

model CreateSampleDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSampleDataResponseBody(name='body'),
}

/**
 * @summary Creates a sample dataset for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   You can call this operation to create a sample dataset for an AnalyticDB for PostgreSQL instance. Then, you can execute query statements on the sample dataset to experience or test your instance. For more information about query statements, see [Dataset information and query examples](https://help.aliyun.com/document_detail/452277.html).
 * *   This operation is supported only for AnalyticDB for PostgreSQL V6.3.8.8 to 6.3.8.x, V6.3.10.3, and later.
 * *   Versions from V6.3.9.0 to V6.3.10.2 are not supported.
 *
 * @param request CreateSampleDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSampleDataResponse
 */
async function createSampleDataWithOptions(request: CreateSampleDataRequest, runtime: Util.RuntimeOptions): CreateSampleDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSampleData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a sample dataset for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   You can call this operation to create a sample dataset for an AnalyticDB for PostgreSQL instance. Then, you can execute query statements on the sample dataset to experience or test your instance. For more information about query statements, see [Dataset information and query examples](https://help.aliyun.com/document_detail/452277.html).
 * *   This operation is supported only for AnalyticDB for PostgreSQL V6.3.8.8 to 6.3.8.x, V6.3.10.3, and later.
 * *   Versions from V6.3.9.0 to V6.3.10.2 are not supported.
 *
 * @param request CreateSampleDataRequest
 * @return CreateSampleDataResponse
 */
async function createSampleData(request: CreateSampleDataRequest): CreateSampleDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSampleDataWithOptions(request, runtime);
}

model CreateSecretRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  description?: string(name='Description', description='The description of the access credential.', example='test'),
  ownerId?: long(name='OwnerId'),
  password?: string(name='Password', description='The password of the database account that is used to access the instance.

This parameter is required.', example='pwd123'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  secretName?: string(name='SecretName', description='The name of the access credential. The name must be 1 to 16 characters in length and can contain letters, digits, and underscores (_). If you leave this parameter empty, the value of the Username parameter is used.', example='testsecret'),
  testConnection?: boolean(name='TestConnection', description='Specifies whether to check the connectivity to the instance by using the name and password of the database account.', example='true'),
  username?: string(name='Username', description='The name of the database account that is used to access the instance.

This parameter is required.', example='testacc'),
  workspaceId?: string(name='WorkspaceId'),
}

model CreateSecretResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  secretName?: string(name='SecretName', description='The name of the access credential.', example='testsecret'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model CreateSecretResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSecretResponseBody(name='body'),
}

/**
 * @summary Creates an access credential for an AnalyticDB for PostgreSQL instance by using the name and password of a database account.
 *
 * @param request CreateSecretRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSecretResponse
 */
async function createSecretWithOptions(request: CreateSecretRequest, runtime: Util.RuntimeOptions): CreateSecretResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.secretName)) {
    query['SecretName'] = request.secretName;
  }
  if (!Util.isUnset(request.testConnection)) {
    query['TestConnection'] = request.testConnection;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSecret',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an access credential for an AnalyticDB for PostgreSQL instance by using the name and password of a database account.
 *
 * @param request CreateSecretRequest
 * @return CreateSecretResponse
 */
async function createSecret(request: CreateSecretRequest): CreateSecretResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSecretWithOptions(request, runtime);
}

model CreateServiceLinkedRoleRequest {
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
}

model CreateServiceLinkedRoleResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CreateServiceLinkedRoleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateServiceLinkedRoleResponseBody(name='body'),
}

/**
 * @summary Creates a service-linked role.
 *
 * @param request CreateServiceLinkedRoleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateServiceLinkedRoleResponse
 */
async function createServiceLinkedRoleWithOptions(request: CreateServiceLinkedRoleRequest, runtime: Util.RuntimeOptions): CreateServiceLinkedRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateServiceLinkedRole',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a service-linked role.
 *
 * @param request CreateServiceLinkedRoleRequest
 * @return CreateServiceLinkedRoleResponse
 */
async function createServiceLinkedRole(request: CreateServiceLinkedRoleRequest): CreateServiceLinkedRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createServiceLinkedRoleWithOptions(request, runtime);
}

model CreateStreamingDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', description='The region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent list of regions.', example='cn-beijing'),
  serviceDescription?: string(name='ServiceDescription', description='The description of the service.', example='test-adbpgss'),
  serviceName?: string(name='ServiceName', description='The name of the service.

This parameter is required.', example='test-adbpgss'),
  serviceSpec?: string(name='ServiceSpec', description='The specifications of the service.

This parameter is required.', example='2'),
}

model CreateStreamingDataServiceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceId?: int32(name='ServiceId', description='The real-time data service ID.', example='1'),
}

model CreateStreamingDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateStreamingDataServiceResponseBody(name='body'),
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request CreateStreamingDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateStreamingDataServiceResponse
 */
async function createStreamingDataServiceWithOptions(request: CreateStreamingDataServiceRequest, runtime: Util.RuntimeOptions): CreateStreamingDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceDescription)) {
    query['ServiceDescription'] = request.serviceDescription;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.serviceSpec)) {
    query['ServiceSpec'] = request.serviceSpec;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateStreamingDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request CreateStreamingDataServiceRequest
 * @return CreateStreamingDataServiceResponse
 */
async function createStreamingDataService(request: CreateStreamingDataServiceRequest): CreateStreamingDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createStreamingDataServiceWithOptions(request, runtime);
}

model CreateStreamingDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='CreateExternalDataSource'),
  dataSourceConfig?: string(name='DataSourceConfig', description='Data source configuration information.

This parameter is required.', example='{"broker_list":"broker0:9091,broker1:9091","topic":"topic"}'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Data source description.', example='test-kafka'),
  dataSourceName?: string(name='DataSourceName', description='Data source name.

This parameter is required.', example='test-kafka'),
  dataSourceType?: string(name='DataSourceType', description='Data source type. Values:
 -  kafka

This parameter is required.', example='kafka'),
  regionId?: string(name='RegionId', description='Region ID.

> You can view available region IDs through the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface.', example='cn-beijing'),
  serviceId?: int32(name='ServiceId', description='Real-time data service ID.

This parameter is required.', example='1'),
}

model CreateStreamingDataSourceResponseBody = {
  dataSourceId?: int32(name='DataSourceId', description='Data source ID.', example='1'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CreateStreamingDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateStreamingDataSourceResponseBody(name='body'),
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request CreateStreamingDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateStreamingDataSourceResponse
 */
async function createStreamingDataSourceWithOptions(request: CreateStreamingDataSourceRequest, runtime: Util.RuntimeOptions): CreateStreamingDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceConfig)) {
    query['DataSourceConfig'] = request.dataSourceConfig;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceName)) {
    query['DataSourceName'] = request.dataSourceName;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    query['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateStreamingDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request CreateStreamingDataSourceRequest
 * @return CreateStreamingDataSourceResponse
 */
async function createStreamingDataSource(request: CreateStreamingDataSourceRequest): CreateStreamingDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createStreamingDataSourceWithOptions(request, runtime);
}

model CreateStreamingJobRequest {
  account?: string(name='Account', description='Target database account.', example='test-account'),
  consistency?: string(name='Consistency', description='Delivery guarantee.', example='ATLEAST / EXACTLY'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.

This parameter is required.', example='1'),
  destColumns?: [ string ](name='DestColumns', description='Target data table mapping field list.'),
  destDatabase?: string(name='DestDatabase', description='Target database name.', example='dest-db'),
  destSchema?: string(name='DestSchema', description='Target namespace.', example='dest-schema'),
  destTable?: string(name='DestTable', description='Target table name.', example='dest-table'),
  errorLimitCount?: long(name='ErrorLimitCount', description='When data in Kafka does not match the ADBPG target table, it will cause a write failure. This value is the number of error rows allowed; exceeding this will cause the task to fail.', example='5'),
  fallbackOffset?: string(name='FallbackOffset', description='FallbackOffset, fallback offset

- The FallbackOffset parameter defines the behavior when the consumer does not request a specific offset or the requested offset exceeds the current Kafka cluster\\\\"s recorded offset information. You can choose to start consuming from the earliest (newest) or latest (oldest) offset.', example='EARLIEST /  LATEST'),
  groupName?: string(name='GroupName', description='Kafka group name', example='group_name.'),
  jobConfig?: string(name='JobConfig', description='Job configuration file, required for professional mode.', example='DATABASE: adbpgss_test
USER: adbpgss_test
PASSWORD: adbpgssTest
HOST: gp-xxx-master.gpdb.rds-aliyun-pre.rds.aliyuncs.com
PORT: 5432
KAFKA:
  INPUT:
    SOURCE:
      BROKERS: broker1:9092,broker2:9092,broker3:9092
      TOPIC: testtopic
      FALLBACK_OFFSET: earliest
    KEY:
      COLUMNS:
      - NAME: customer_id
        TYPE: int
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    VALUE:
      COLUMNS:
      - TYPE: integer
        NAME: l_orderkey
      - TYPE: integer
        NAME: l_partkey
      - TYPE: integer
        NAME: l_suppkey
      - TYPE: integer
        NAME: l_linenumber
      - TYPE: decimal
        NAME: l_quantity
      - TYPE: decimal
        NAME: l_extendedprice
      - TYPE: decimal
        NAME: l_discount
      - TYPE: decimal
        NAME: l_tax
      - TYPE: char
        NAME: l_returnflag
      - TYPE: char
        NAME: l_linestatus
      - TYPE: date
        NAME: l_shipdate
      - TYPE: date
        NAME: l_commitdate
      - TYPE: date
        NAME: l_receiptdate
      - TYPE: text
        NAME: l_shipinstruct
      - TYPE: text
        NAME: l_shipmode
      - TYPE: text
        NAME: l_comment
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    ERROR_LIMIT: 10
  OUTPUT:
    SCHEMA: adbpgss_test
    TABLE: write_with_insert_plaintext
    MODE: MERGE
    MATCH_COLUMNS:
    - l_orderkey
    - l_partkey
    - l_suppkey
    UPDATE_COLUMNS:
    - l_linenumber
    - l_quantity
    - l_extendedprice
    - l_discount
    - l_tax
    - l_returnflag
    - l_linestatus
    - l_shipdate
    - l_commitdate
    - l_receiptdate
    - l_shipinstruct
    - l_shipmode
    - l_comment
    MAPPING:
    - EXPRESSION: l_orderkey
      NAME: l_orderkey
    - EXPRESSION: l_partkey
      NAME: l_partkey
    - EXPRESSION: l_suppkey
      NAME: l_suppkey
    - EXPRESSION: l_linenumber
      NAME: l_linenumber
    - EXPRESSION: l_quantity
      NAME: l_quantity
    - EXPRESSION: l_extendedprice
      NAME: l_extendedprice
    - EXPRESSION: l_discount
      NAME: l_discount
    - EXPRESSION: l_tax
      NAME: l_tax
    - EXPRESSION: l_returnflag
      NAME: l_returnflag
    - EXPRESSION: l_linestatus
      NAME: l_linestatus
    - EXPRESSION: l_shipdate
      NAME: l_shipdate
    - EXPRESSION: l_commitdate
      NAME: l_commitdate
    - EXPRESSION: l_receiptdate
      NAME: l_receiptdate
    - EXPRESSION: l_shipinstruct
      NAME: l_shipinstruct
    - EXPRESSION: l_shipmode
      NAME: l_shipmode
    - EXPRESSION: l_comment
      NAME: l_comment
  COMMIT:
    MAX_ROW: 1000
    MINIMAL_INTERVAL: 1000
    CONSISTENCY: ATLEAST
  POLL:
    BATCHSIZE: 1000
    TIMEOUT: 1000
  PROPERTIES:
    group.id: testgroup'),
  jobDescription?: string(name='JobDescription', description='Job description.', example='test-job'),
  jobName?: string(name='JobName', description='Job name.

This parameter is required.', example='test-job'),
  matchColumns?: [ string ](name='MatchColumns', description='Match columns, usually all primary key columns of the target table. If all column values in this configuration are the same, the two rows of data are considered duplicates.'),
  mode?: string(name='Mode', description='Configuration mode
1. Basic mode requires specifying some configuration fields
1. Professional mode supports submitting a YAML file', example='basic / professional'),
  password?: string(name='Password', description='Target database password.', example='pwd123'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
  srcColumns?: [ string ](name='SrcColumns', description='Source data field list.'),
  tryRun?: boolean(name='TryRun', description='Whether to test the real-time task, values:

- true

- false

Default value: false.', example='true'),
  updateColumns?: [ string ](name='UpdateColumns', description='Update columns, usually all non-primary key columns of the target table. When data is determined to be duplicate through MatchColumns, updating the UpdateColumns column values will result in new data overwriting old data.'),
  writeMode?: string(name='WriteMode', description='Write mode.', example='INSERT/UPDATE/MERGE'),
}

model CreateStreamingJobShrinkRequest {
  account?: string(name='Account', description='Target database account.', example='test-account'),
  consistency?: string(name='Consistency', description='Delivery guarantee.', example='ATLEAST / EXACTLY'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.

This parameter is required.', example='1'),
  destColumnsShrink?: string(name='DestColumns', description='Target data table mapping field list.'),
  destDatabase?: string(name='DestDatabase', description='Target database name.', example='dest-db'),
  destSchema?: string(name='DestSchema', description='Target namespace.', example='dest-schema'),
  destTable?: string(name='DestTable', description='Target table name.', example='dest-table'),
  errorLimitCount?: long(name='ErrorLimitCount', description='When data in Kafka does not match the ADBPG target table, it will cause a write failure. This value is the number of error rows allowed; exceeding this will cause the task to fail.', example='5'),
  fallbackOffset?: string(name='FallbackOffset', description='FallbackOffset, fallback offset

- The FallbackOffset parameter defines the behavior when the consumer does not request a specific offset or the requested offset exceeds the current Kafka cluster\\\\"s recorded offset information. You can choose to start consuming from the earliest (newest) or latest (oldest) offset.', example='EARLIEST /  LATEST'),
  groupName?: string(name='GroupName', description='Kafka group name', example='group_name.'),
  jobConfig?: string(name='JobConfig', description='Job configuration file, required for professional mode.', example='DATABASE: adbpgss_test
USER: adbpgss_test
PASSWORD: adbpgssTest
HOST: gp-xxx-master.gpdb.rds-aliyun-pre.rds.aliyuncs.com
PORT: 5432
KAFKA:
  INPUT:
    SOURCE:
      BROKERS: broker1:9092,broker2:9092,broker3:9092
      TOPIC: testtopic
      FALLBACK_OFFSET: earliest
    KEY:
      COLUMNS:
      - NAME: customer_id
        TYPE: int
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    VALUE:
      COLUMNS:
      - TYPE: integer
        NAME: l_orderkey
      - TYPE: integer
        NAME: l_partkey
      - TYPE: integer
        NAME: l_suppkey
      - TYPE: integer
        NAME: l_linenumber
      - TYPE: decimal
        NAME: l_quantity
      - TYPE: decimal
        NAME: l_extendedprice
      - TYPE: decimal
        NAME: l_discount
      - TYPE: decimal
        NAME: l_tax
      - TYPE: char
        NAME: l_returnflag
      - TYPE: char
        NAME: l_linestatus
      - TYPE: date
        NAME: l_shipdate
      - TYPE: date
        NAME: l_commitdate
      - TYPE: date
        NAME: l_receiptdate
      - TYPE: text
        NAME: l_shipinstruct
      - TYPE: text
        NAME: l_shipmode
      - TYPE: text
        NAME: l_comment
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    ERROR_LIMIT: 10
  OUTPUT:
    SCHEMA: adbpgss_test
    TABLE: write_with_insert_plaintext
    MODE: MERGE
    MATCH_COLUMNS:
    - l_orderkey
    - l_partkey
    - l_suppkey
    UPDATE_COLUMNS:
    - l_linenumber
    - l_quantity
    - l_extendedprice
    - l_discount
    - l_tax
    - l_returnflag
    - l_linestatus
    - l_shipdate
    - l_commitdate
    - l_receiptdate
    - l_shipinstruct
    - l_shipmode
    - l_comment
    MAPPING:
    - EXPRESSION: l_orderkey
      NAME: l_orderkey
    - EXPRESSION: l_partkey
      NAME: l_partkey
    - EXPRESSION: l_suppkey
      NAME: l_suppkey
    - EXPRESSION: l_linenumber
      NAME: l_linenumber
    - EXPRESSION: l_quantity
      NAME: l_quantity
    - EXPRESSION: l_extendedprice
      NAME: l_extendedprice
    - EXPRESSION: l_discount
      NAME: l_discount
    - EXPRESSION: l_tax
      NAME: l_tax
    - EXPRESSION: l_returnflag
      NAME: l_returnflag
    - EXPRESSION: l_linestatus
      NAME: l_linestatus
    - EXPRESSION: l_shipdate
      NAME: l_shipdate
    - EXPRESSION: l_commitdate
      NAME: l_commitdate
    - EXPRESSION: l_receiptdate
      NAME: l_receiptdate
    - EXPRESSION: l_shipinstruct
      NAME: l_shipinstruct
    - EXPRESSION: l_shipmode
      NAME: l_shipmode
    - EXPRESSION: l_comment
      NAME: l_comment
  COMMIT:
    MAX_ROW: 1000
    MINIMAL_INTERVAL: 1000
    CONSISTENCY: ATLEAST
  POLL:
    BATCHSIZE: 1000
    TIMEOUT: 1000
  PROPERTIES:
    group.id: testgroup'),
  jobDescription?: string(name='JobDescription', description='Job description.', example='test-job'),
  jobName?: string(name='JobName', description='Job name.

This parameter is required.', example='test-job'),
  matchColumnsShrink?: string(name='MatchColumns', description='Match columns, usually all primary key columns of the target table. If all column values in this configuration are the same, the two rows of data are considered duplicates.'),
  mode?: string(name='Mode', description='Configuration mode
1. Basic mode requires specifying some configuration fields
1. Professional mode supports submitting a YAML file', example='basic / professional'),
  password?: string(name='Password', description='Target database password.', example='pwd123'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
  srcColumnsShrink?: string(name='SrcColumns', description='Source data field list.'),
  tryRun?: boolean(name='TryRun', description='Whether to test the real-time task, values:

- true

- false

Default value: false.', example='true'),
  updateColumnsShrink?: string(name='UpdateColumns', description='Update columns, usually all non-primary key columns of the target table. When data is determined to be duplicate through MatchColumns, updating the UpdateColumns column values will result in new data overwriting old data.'),
  writeMode?: string(name='WriteMode', description='Write mode.', example='INSERT/UPDATE/MERGE'),
}

model CreateStreamingJobResponseBody = {
  jobId?: int32(name='JobId', description='Job ID.', example='1'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model CreateStreamingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateStreamingJobResponseBody(name='body'),
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param tmpReq CreateStreamingJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateStreamingJobResponse
 */
async function createStreamingJobWithOptions(tmpReq: CreateStreamingJobRequest, runtime: Util.RuntimeOptions): CreateStreamingJobResponse {
  Util.validateModel(tmpReq);
  var request = new CreateStreamingJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.destColumns)) {
    request.destColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.destColumns, 'DestColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.matchColumns)) {
    request.matchColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.matchColumns, 'MatchColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.srcColumns)) {
    request.srcColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.srcColumns, 'SrcColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.updateColumns)) {
    request.updateColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.updateColumns, 'UpdateColumns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.account)) {
    query['Account'] = request.account;
  }
  if (!Util.isUnset(request.consistency)) {
    query['Consistency'] = request.consistency;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.destColumnsShrink)) {
    query['DestColumns'] = request.destColumnsShrink;
  }
  if (!Util.isUnset(request.destDatabase)) {
    query['DestDatabase'] = request.destDatabase;
  }
  if (!Util.isUnset(request.destSchema)) {
    query['DestSchema'] = request.destSchema;
  }
  if (!Util.isUnset(request.destTable)) {
    query['DestTable'] = request.destTable;
  }
  if (!Util.isUnset(request.errorLimitCount)) {
    query['ErrorLimitCount'] = request.errorLimitCount;
  }
  if (!Util.isUnset(request.fallbackOffset)) {
    query['FallbackOffset'] = request.fallbackOffset;
  }
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.jobConfig)) {
    query['JobConfig'] = request.jobConfig;
  }
  if (!Util.isUnset(request.jobDescription)) {
    query['JobDescription'] = request.jobDescription;
  }
  if (!Util.isUnset(request.jobName)) {
    query['JobName'] = request.jobName;
  }
  if (!Util.isUnset(request.matchColumnsShrink)) {
    query['MatchColumns'] = request.matchColumnsShrink;
  }
  if (!Util.isUnset(request.mode)) {
    query['Mode'] = request.mode;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.srcColumnsShrink)) {
    query['SrcColumns'] = request.srcColumnsShrink;
  }
  if (!Util.isUnset(request.tryRun)) {
    query['TryRun'] = request.tryRun;
  }
  if (!Util.isUnset(request.updateColumnsShrink)) {
    query['UpdateColumns'] = request.updateColumnsShrink;
  }
  if (!Util.isUnset(request.writeMode)) {
    query['WriteMode'] = request.writeMode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateStreamingJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request CreateStreamingJobRequest
 * @return CreateStreamingJobResponse
 */
async function createStreamingJob(request: CreateStreamingJobRequest): CreateStreamingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createStreamingJobWithOptions(request, runtime);
}

model CreateVectorIndexRequest {
  collection?: string(name='Collection', description='Collection name.
> You can use the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) API to view the list.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  dimension?: int32(name='Dimension', description='Vector dimension.
> This value must be consistent with the length of the vector data (Rows. Vector) uploaded via the [UpsertCollectionData](https://help.aliyun.com/document_detail/2401493.html) API.', example='1024'),
  externalStorage?: int32(name='ExternalStorage', description='Whether to use mmap to build the HNSW index, default is 0. If the data does not need to be deleted and there are performance requirements for uploading data, it is recommended to set this to 1.

> 
> - When set to 0, the segment-page storage mode is used to build the index, which can use the shared_buffer in PostgreSQL for caching and supports deletion and update operations.
> - When set to 1, the index is built using mmap, which does not support deletion and update operations.', example='0'),
  hnswEfConstruction?: int32(name='HnswEfConstruction'),
  hnswM?: int32(name='HnswM', description='The maximum number of neighbors in the HNSW algorithm, ranging from 1 to 1000. The API will automatically set this value based on the vector dimension, and it generally does not need to be manually set.

> It is suggested to set this based on the vector dimension as follows:
> - Less than or equal to 384: 16
> - Greater than 384 and less than or equal to 768: 32
> - Greater than 768 and less than or equal to 1024: 64
> - Greater than 1024: 128', example='64'),
  managerAccount?: string(name='ManagerAccount', description='Name of the management account with rds_superuser permissions.

> You can create an account through the console -> Account Management, or by using the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) API.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='Management account password.

This parameter is required.', example='testpassword'),
  metrics?: string(name='Metrics', description='Method used for building the vector index. Value description:
- l2: Euclidean distance.
- ip: Inner product (dot product) distance.
- cosine: Cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can use the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API to view the list.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  pqEnable?: int32(name='PqEnable', description='Whether to enable PQ (Product Quantization) algorithm acceleration for the index. It is recommended to enable this when the data volume exceeds 500,000. Value description:
- 0: Disabled.
- 1: Enabled (default).', example='1'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  type?: string(name='Type'),
}

model CreateVectorIndexResponseBody = {
  message?: string(name='Message', description='Detailed information returned by the API.', example='Successful'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='API execution status. Value description:
- **success**: Execution succeeded.
- **fail**: Execution failed.', example='success'),
}

model CreateVectorIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateVectorIndexResponseBody(name='body'),
}

/**
 * @summary Create Vector Index
 *
 * @param request CreateVectorIndexRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateVectorIndexResponse
 */
async function createVectorIndexWithOptions(request: CreateVectorIndexRequest, runtime: Util.RuntimeOptions): CreateVectorIndexResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dimension)) {
    query['Dimension'] = request.dimension;
  }
  if (!Util.isUnset(request.externalStorage)) {
    query['ExternalStorage'] = request.externalStorage;
  }
  if (!Util.isUnset(request.hnswEfConstruction)) {
    query['HnswEfConstruction'] = request.hnswEfConstruction;
  }
  if (!Util.isUnset(request.hnswM)) {
    query['HnswM'] = request.hnswM;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.metrics)) {
    query['Metrics'] = request.metrics;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pqEnable)) {
    query['PqEnable'] = request.pqEnable;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateVectorIndex',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create Vector Index
 *
 * @param request CreateVectorIndexRequest
 * @return CreateVectorIndexResponse
 */
async function createVectorIndex(request: CreateVectorIndexRequest): CreateVectorIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  return createVectorIndexWithOptions(request, runtime);
}

model DeleteAccountRequest {
  accountName?: string(name='AccountName', description='The name of the database account. The privileged account cannot be deleted.

This parameter is required.', example='testuser'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp***************'),
}

model DeleteAccountResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396****'),
}

model DeleteAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAccountResponseBody(name='body'),
}

/**
 * @summary 删除数据库账号
 *
 * @param request DeleteAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAccountResponse
 */
async function deleteAccountWithOptions(request: DeleteAccountRequest, runtime: Util.RuntimeOptions): DeleteAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAccount',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除数据库账号
 *
 * @param request DeleteAccountRequest
 * @return DeleteAccountResponse
 */
async function deleteAccount(request: DeleteAccountRequest): DeleteAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAccountWithOptions(request, runtime);
}

model DeleteBackupRequest {
  backupId?: string(name='BackupId', description='This parameter is required.', example='1111111111'),
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
}

model DeleteBackupResponseBody = {
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DeleteBackupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteBackupResponseBody(name='body'),
}

/**
 * @summary 删除备份
 *
 * @param request DeleteBackupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteBackupResponse
 */
async function deleteBackupWithOptions(request: DeleteBackupRequest, runtime: Util.RuntimeOptions): DeleteBackupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupId)) {
    query['BackupId'] = request.backupId;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteBackup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除备份
 *
 * @param request DeleteBackupRequest
 * @return DeleteBackupResponse
 */
async function deleteBackup(request: DeleteBackupRequest): DeleteBackupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteBackupWithOptions(request, runtime);
}

model DeleteCollectionRequest {
  collection?: string(name='Collection', description='The name of the collection.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model DeleteCollectionResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DeleteCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCollectionResponseBody(name='body'),
}

/**
 * @summary Deletes a vector collection.
 *
 * @param request DeleteCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCollectionResponse
 */
async function deleteCollectionWithOptions(request: DeleteCollectionRequest, runtime: Util.RuntimeOptions): DeleteCollectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a vector collection.
 *
 * @param request DeleteCollectionRequest
 * @return DeleteCollectionResponse
 */
async function deleteCollection(request: DeleteCollectionRequest): DeleteCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCollectionWithOptions(request, runtime);
}

model DeleteCollectionDataRequest {
  collection?: string(name='Collection', description='The name of the collection.

This parameter is required.', example='document'),
  collectionData?: string(name='CollectionData', description='The data that you want to delete.', example='{"title":["a","b"]}'),
  collectionDataFilter?: string(name='CollectionDataFilter', description='The filter conditions for the data to be deleted.', example='a < 10'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model DeleteCollectionDataResponseBody = {
  appliedRows?: long(name='AppliedRows', description='The number of rows that are affected by the request.', example='10'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DeleteCollectionDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCollectionDataResponseBody(name='body'),
}

/**
 * @summary Deletes vector data.
 *
 * @param request DeleteCollectionDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCollectionDataResponse
 */
async function deleteCollectionDataWithOptions(request: DeleteCollectionDataRequest, runtime: Util.RuntimeOptions): DeleteCollectionDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.collectionData)) {
    query['CollectionData'] = request.collectionData;
  }
  if (!Util.isUnset(request.collectionDataFilter)) {
    query['CollectionDataFilter'] = request.collectionDataFilter;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCollectionData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes vector data.
 *
 * @param request DeleteCollectionDataRequest
 * @return DeleteCollectionDataResponse
 */
async function deleteCollectionData(request: DeleteCollectionDataRequest): DeleteCollectionDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCollectionDataWithOptions(request, runtime);
}

model DeleteDBInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/327176.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  ownerId?: long(name='OwnerId'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
}

model DeleteDBInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='65BDA532-28AF-4122-AA39-B3**********'),
}

model DeleteDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDBInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a pay-as-you-go AnalyticDB for PostgreSQL instance.
 *
 * @description *   Subscription instances cannot be manually released. They are automatically released when they expire.
 * *   You can call this operation to release pay-as-you-go instances only when they are in the **Running** state.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDBInstanceResponse
 */
async function deleteDBInstanceWithOptions(request: DeleteDBInstanceRequest, runtime: Util.RuntimeOptions): DeleteDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a pay-as-you-go AnalyticDB for PostgreSQL instance.
 *
 * @description *   Subscription instances cannot be manually released. They are automatically released when they expire.
 * *   You can call this operation to release pay-as-you-go instances only when they are in the **Running** state.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteDBInstanceRequest
 * @return DeleteDBInstanceResponse
 */
async function deleteDBInstance(request: DeleteDBInstanceRequest): DeleteDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDBInstanceWithOptions(request, runtime);
}

model DeleteDBInstancePlanRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  planId?: string(name='PlanId', description='The ID of the plan.

>  You can call the [DescribeDBInstancePlans](https://help.aliyun.com/document_detail/449398.html) operation to query the details of plans, including plan IDs.

This parameter is required.', example='1234'),
}

model DeleteDBInstancePlanResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only when the operation fails.', example='****'),
  planId?: string(name='PlanId', description='The ID of the plan.', example='1234'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34b32a0a-08ef-4a87-b6be-cdd988888888'),
  status?: string(name='Status', description='The state of the operation.

If the operation is successful, **success** is returned. If the operation fails, this parameter is not returned.', example='success'),
}

model DeleteDBInstancePlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDBInstancePlanResponseBody(name='body'),
}

/**
 * @summary Deletes a plan from an AnalyticDB for PostgreSQL instance.
 *
 * @description If you no longer need a plan, you can call this operation to delete the plan. The plan management feature is supported only for AnalyticDB for PostgreSQL instances in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteDBInstancePlanRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDBInstancePlanResponse
 */
async function deleteDBInstancePlanWithOptions(request: DeleteDBInstancePlanRequest, runtime: Util.RuntimeOptions): DeleteDBInstancePlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDBInstancePlan',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a plan from an AnalyticDB for PostgreSQL instance.
 *
 * @description If you no longer need a plan, you can call this operation to delete the plan. The plan management feature is supported only for AnalyticDB for PostgreSQL instances in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteDBInstancePlanRequest
 * @return DeleteDBInstancePlanResponse
 */
async function deleteDBInstancePlan(request: DeleteDBInstancePlanRequest): DeleteDBInstancePlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDBInstancePlanWithOptions(request, runtime);
}

model DeleteDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
}

model DeleteDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DeleteDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Deletes a resource group.
 *
 * @param request DeleteDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDBResourceGroupResponse
 */
async function deleteDBResourceGroupWithOptions(request: DeleteDBResourceGroupRequest, runtime: Util.RuntimeOptions): DeleteDBResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a resource group.
 *
 * @param request DeleteDBResourceGroupRequest
 * @return DeleteDBResourceGroupResponse
 */
async function deleteDBResourceGroup(request: DeleteDBResourceGroupRequest): DeleteDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDBResourceGroupWithOptions(request, runtime);
}

model DeleteDocumentRequest {
  collection?: string(name='Collection', description='Document collection name.


> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the list of created document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='File name.

> The name of an uploaded file. You can query the list of files using the [ListDocuments](https://help.aliyun.com/document_detail/2618453.html) API.

This parameter is required.', example='music.txt'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create a namespace using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list of namespaces using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified in the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteDocumentResponseBody = {
  message?: string(name='Message', description='Detailed information returned by the API.', example='success'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Creation status, value description: - **success**: Success - **fail**: Fail', example='success'),
}

model DeleteDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDocumentResponseBody(name='body'),
}

/**
 * @summary Delete Document
 *
 * @param request DeleteDocumentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDocumentResponse
 */
async function deleteDocumentWithOptions(request: DeleteDocumentRequest, runtime: Util.RuntimeOptions): DeleteDocumentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDocument',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Delete Document
 *
 * @param request DeleteDocumentRequest
 * @return DeleteDocumentResponse
 */
async function deleteDocument(request: DeleteDocumentRequest): DeleteDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDocumentWithOptions(request, runtime);
}

model DeleteDocumentCollectionRequest {
  collection?: string(name='Collection', description='The name of the document collection to be deleted.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create a namespace using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list of namespaces using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified by the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance is located.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteDocumentCollectionResponseBody = {
  message?: string(name='Message', description='Return message.', example='Successful'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Status, with the following possible values:
- **success**: Success.
- **fail**: Failure.', example='success'),
}

model DeleteDocumentCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDocumentCollectionResponseBody(name='body'),
}

/**
 * @summary Delete Knowledge Base
 *
 * @param request DeleteDocumentCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDocumentCollectionResponse
 */
async function deleteDocumentCollectionWithOptions(request: DeleteDocumentCollectionRequest, runtime: Util.RuntimeOptions): DeleteDocumentCollectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDocumentCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Delete Knowledge Base
 *
 * @param request DeleteDocumentCollectionRequest
 * @return DeleteDocumentCollectionResponse
 */
async function deleteDocumentCollection(request: DeleteDocumentCollectionRequest): DeleteDocumentCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDocumentCollectionWithOptions(request, runtime);
}

model DeleteExtensionRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-xxxxxxxxx'),
  DBNames?: string(name='DBNames', description='The name of the database.

This parameter is required.', example='demo1'),
  extension?: string(name='Extension', description='The name of the extension.

This parameter is required.', example='citext'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
}

model DeleteExtensionResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DeleteExtensionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteExtensionResponseBody(name='body'),
}

/**
 * @summary Uninstall an extension.
 *
 * @param request DeleteExtensionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteExtensionResponse
 */
async function deleteExtensionWithOptions(request: DeleteExtensionRequest, runtime: Util.RuntimeOptions): DeleteExtensionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.DBNames)) {
    query['DBNames'] = request.DBNames;
  }
  if (!Util.isUnset(request.extension)) {
    query['Extension'] = request.extension;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteExtension',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Uninstall an extension.
 *
 * @param request DeleteExtensionRequest
 * @return DeleteExtensionResponse
 */
async function deleteExtension(request: DeleteExtensionRequest): DeleteExtensionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteExtensionWithOptions(request, runtime);
}

model DeleteExternalDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxx'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-hangzhou'),
  serviceId?: string(name='ServiceId', description='Service ID.

This parameter is required.', example='1'),
}

model DeleteExternalDataServiceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DeleteExternalDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteExternalDataServiceResponseBody(name='body'),
}

/**
 * @summary Delete External Data Service
 *
 * @param request DeleteExternalDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteExternalDataServiceResponse
 */
async function deleteExternalDataServiceWithOptions(request: DeleteExternalDataServiceRequest, runtime: Util.RuntimeOptions): DeleteExternalDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteExternalDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Delete External Data Service
 *
 * @param request DeleteExternalDataServiceRequest
 * @return DeleteExternalDataServiceResponse
 */
async function deleteExternalDataService(request: DeleteExternalDataServiceRequest): DeleteExternalDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteExternalDataServiceWithOptions(request, runtime);
}

model DeleteHadoopDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceId?: string(name='DataSourceId', description='The service ID.

This parameter is required.', example='123'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
}

model DeleteHadoopDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DeleteHadoopDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteHadoopDataSourceResponseBody(name='body'),
}

/**
 * @summary 删除hadoop数据源
 *
 * @param request DeleteHadoopDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteHadoopDataSourceResponse
 */
async function deleteHadoopDataSourceWithOptions(request: DeleteHadoopDataSourceRequest, runtime: Util.RuntimeOptions): DeleteHadoopDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteHadoopDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除hadoop数据源
 *
 * @param request DeleteHadoopDataSourceRequest
 * @return DeleteHadoopDataSourceResponse
 */
async function deleteHadoopDataSource(request: DeleteHadoopDataSourceRequest): DeleteHadoopDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteHadoopDataSourceWithOptions(request, runtime);
}

model DeleteIndexRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  indexName?: string(name='IndexName', description='This parameter is required.', example='testindex'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model DeleteIndexResponseBody = {
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model DeleteIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteIndexResponseBody(name='body'),
}

/**
 * @summary 删除索引
 *
 * @param request DeleteIndexRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteIndexResponse
 */
async function deleteIndexWithOptions(request: DeleteIndexRequest, runtime: Util.RuntimeOptions): DeleteIndexResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.indexName)) {
    query['IndexName'] = request.indexName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteIndex',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除索引
 *
 * @param request DeleteIndexRequest
 * @return DeleteIndexResponse
 */
async function deleteIndex(request: DeleteIndexRequest): DeleteIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteIndexWithOptions(request, runtime);
}

model DeleteJDBCDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.

This parameter is required.', example='123'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available region IDs.', example='cn-hangzhou'),
}

model DeleteJDBCDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DeleteJDBCDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteJDBCDataSourceResponseBody(name='body'),
}

/**
 * @summary Delete JDBC data source
 *
 * @param request DeleteJDBCDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteJDBCDataSourceResponse
 */
async function deleteJDBCDataSourceWithOptions(request: DeleteJDBCDataSourceRequest, runtime: Util.RuntimeOptions): DeleteJDBCDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteJDBCDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Delete JDBC data source
 *
 * @param request DeleteJDBCDataSourceRequest
 * @return DeleteJDBCDataSourceResponse
 */
async function deleteJDBCDataSource(request: DeleteJDBCDataSourceRequest): DeleteJDBCDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteJDBCDataSourceWithOptions(request, runtime);
}

model DeleteNamespaceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.

This parameter is required.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model DeleteNamespaceResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DeleteNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteNamespaceResponseBody(name='body'),
}

/**
 * @summary Deletes a namespace.
 *
 * @param request DeleteNamespaceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteNamespaceResponse
 */
async function deleteNamespaceWithOptions(request: DeleteNamespaceRequest, runtime: Util.RuntimeOptions): DeleteNamespaceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteNamespace',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a namespace.
 *
 * @param request DeleteNamespaceRequest
 * @return DeleteNamespaceResponse
 */
async function deleteNamespace(request: DeleteNamespaceRequest): DeleteNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteNamespaceWithOptions(request, runtime);
}

model DeleteRemoteADBDataSourceRequest {
  dataSourceId?: string(name='DataSourceId', description='The service ID.

This parameter is required.', example='1'),
  localDBInstanceId?: string(name='LocalDBInstanceId', description='The ID of the instance that uses the data provided by another instance.

This parameter is required.', example='gp-test'),
  ownerId?: long(name='OwnerId'),
}

model DeleteRemoteADBDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='e9d60eb1-e90d-4bc6-a470-c8b767460858'),
  taskId?: int32(name='TaskId', description='The job ID.', example='90000'),
}

model DeleteRemoteADBDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRemoteADBDataSourceResponseBody(name='body'),
}

/**
 * @summary Deletes a remote AnalyticDB data source.
 *
 * @param request DeleteRemoteADBDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRemoteADBDataSourceResponse
 */
async function deleteRemoteADBDataSourceWithOptions(request: DeleteRemoteADBDataSourceRequest, runtime: Util.RuntimeOptions): DeleteRemoteADBDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.localDBInstanceId)) {
    query['LocalDBInstanceId'] = request.localDBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteRemoteADBDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a remote AnalyticDB data source.
 *
 * @param request DeleteRemoteADBDataSourceRequest
 * @return DeleteRemoteADBDataSourceResponse
 */
async function deleteRemoteADBDataSource(request: DeleteRemoteADBDataSourceRequest): DeleteRemoteADBDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteRemoteADBDataSourceWithOptions(request, runtime);
}

model DeleteSecretRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID. You can call the DescribeDBInstances operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

>', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.

>  You must specify one of the SecretArn and SecretName parameters.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  secretName?: string(name='SecretName', description='The name of the access credential.

>  You must specify one of the SecretArn and SecretName parameters.', example='testsecret'),
  workspaceId?: string(name='WorkspaceId'),
}

model DeleteSecretResponseBody = {
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  secretArn?: string(name='SecretArn', description='The ARN of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **fail**
*   **success**', example='success'),
}

model DeleteSecretResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSecretResponseBody(name='body'),
}

/**
 * @summary Deletes the access credentials of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DeleteSecretRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSecretResponse
 */
async function deleteSecretWithOptions(request: DeleteSecretRequest, runtime: Util.RuntimeOptions): DeleteSecretResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.secretName)) {
    query['SecretName'] = request.secretName;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSecret',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes the access credentials of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DeleteSecretRequest
 * @return DeleteSecretResponse
 */
async function deleteSecret(request: DeleteSecretRequest): DeleteSecretResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSecretWithOptions(request, runtime);
}

model DeleteStreamingDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  serviceId?: string(name='ServiceId', description='The service ID.

This parameter is required.', example='1'),
}

model DeleteStreamingDataServiceResponseBody = {
  errorMessage?: string(name='ErrorMessage', description='The error message returned if the operation fails.

This parameter is returned only when the return value of **Status** is **false**.', example='This external service cannot be deleted because it is still used by other data source.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  status?: boolean(name='Status', description='The status of the operation. Valid values:

*   **false**: The operation fails.
*   **true**: The operation is successful.', example='true'),
}

model DeleteStreamingDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteStreamingDataServiceResponseBody(name='body'),
}

/**
 * @summary Deletes a real-time data service.
 *
 * @param request DeleteStreamingDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteStreamingDataServiceResponse
 */
async function deleteStreamingDataServiceWithOptions(request: DeleteStreamingDataServiceRequest, runtime: Util.RuntimeOptions): DeleteStreamingDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteStreamingDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a real-time data service.
 *
 * @param request DeleteStreamingDataServiceRequest
 * @return DeleteStreamingDataServiceResponse
 */
async function deleteStreamingDataService(request: DeleteStreamingDataServiceRequest): DeleteStreamingDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteStreamingDataServiceWithOptions(request, runtime);
}

model DeleteStreamingDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  dataSourceId?: int32(name='DataSourceId', description='The data source ID.

This parameter is required.', example='1'),
  regionId?: string(name='RegionId', example='cn-beijing'),
}

model DeleteStreamingDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DeleteStreamingDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteStreamingDataSourceResponseBody(name='body'),
}

/**
 * @summary Deletes a real-time data source.
 *
 * @param request DeleteStreamingDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteStreamingDataSourceResponse
 */
async function deleteStreamingDataSourceWithOptions(request: DeleteStreamingDataSourceRequest, runtime: Util.RuntimeOptions): DeleteStreamingDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteStreamingDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a real-time data source.
 *
 * @param request DeleteStreamingDataSourceRequest
 * @return DeleteStreamingDataSourceResponse
 */
async function deleteStreamingDataSource(request: DeleteStreamingDataSourceRequest): DeleteStreamingDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteStreamingDataSourceWithOptions(request, runtime);
}

model DeleteStreamingJobRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  jobId?: int32(name='JobId', description='The job ID.

This parameter is required.', example='1'),
  regionId?: string(name='RegionId', example='cn-beijing'),
}

model DeleteStreamingJobResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DeleteStreamingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteStreamingJobResponseBody(name='body'),
}

/**
 * @summary Deletes a real-time data service job.
 *
 * @param request DeleteStreamingJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteStreamingJobResponse
 */
async function deleteStreamingJobWithOptions(request: DeleteStreamingJobRequest, runtime: Util.RuntimeOptions): DeleteStreamingJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteStreamingJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a real-time data service job.
 *
 * @param request DeleteStreamingJobRequest
 * @return DeleteStreamingJobResponse
 */
async function deleteStreamingJob(request: DeleteStreamingJobRequest): DeleteStreamingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteStreamingJobWithOptions(request, runtime);
}

model DeleteVectorIndexRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the **Account Management** page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  type?: string(name='Type'),
}

model DeleteVectorIndexResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DeleteVectorIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteVectorIndexResponseBody(name='body'),
}

/**
 * @summary Deletes a vector index.
 *
 * @param request DeleteVectorIndexRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteVectorIndexResponse
 */
async function deleteVectorIndexWithOptions(request: DeleteVectorIndexRequest, runtime: Util.RuntimeOptions): DeleteVectorIndexResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteVectorIndex',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a vector index.
 *
 * @param request DeleteVectorIndexRequest
 * @return DeleteVectorIndexResponse
 */
async function deleteVectorIndex(request: DeleteVectorIndexRequest): DeleteVectorIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteVectorIndexWithOptions(request, runtime);
}

model DescribeAccountsRequest {
  accountName?: string(name='AccountName', description='The name of the database account.', example='testuser'),
  accountType?: string(name='AccountType', description='The type of the database account that you want to query. Valid values: Super, Normal, and All. Default value: Super. If you set this parameter to Super, the information about the privileged account is returned. If you set this parameter to Normal, the information about all standard accounts is returned. If you set this parameter to All, the information about all database accounts is returned.', example='Super'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
}

model DescribeAccountsResponseBody = {
  accounts?: {
    DBInstanceAccount?: [ 
    {
      accountDescription?: string(name='AccountDescription', description='The description of the account.', example='testuser'),
      accountName?: string(name='AccountName', description='The name of the account.', example='testuser'),
      accountStatus?: string(name='AccountStatus', description='The state of the account.

*   **0**: The account is being created.
*   **1**: The account is in use.
*   **3**: The account is being deleted.', example='1'),
      accountType?: string(name='AccountType', description='The type of the database account. Valid values: Super and Normal. Super indicates a privileged account and Normal indicates a standard account.', example='Super'),
      DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp***************'),
    }
  ](name='DBInstanceAccount')
  }(name='Accounts', description='The queried database accounts.'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396F2CAD1'),
}

model DescribeAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAccountsResponseBody(name='body'),
}

/**
 * @summary Queries the information about database accounts for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is called to query the information of the privileged account in an AnalyticDB for PostgreSQL instance, such as its state, description, and the instance.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAccountsResponse
 */
async function describeAccountsWithOptions(request: DescribeAccountsRequest, runtime: Util.RuntimeOptions): DescribeAccountsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.accountType)) {
    query['AccountType'] = request.accountType;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAccounts',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about database accounts for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is called to query the information of the privileged account in an AnalyticDB for PostgreSQL instance, such as its state, description, and the instance.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeAccountsRequest
 * @return DescribeAccountsResponse
 */
async function describeAccounts(request: DescribeAccountsRequest): DescribeAccountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAccountsWithOptions(request, runtime);
}

model DescribeActiveSQLRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='testdb'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The end time must be later than the start time.', example='2022-05-07T07:59Z'),
  keyword?: string(name='Keyword', description='The keyword used to filter queries.', example='SELECT'),
  maxDuration?: string(name='MaxDuration', description='The maxmum amount of time consumed by traces. Unit: milliseconds.', example='600'),
  minDuration?: string(name='MinDuration', description='The minimum amount of time consumed by traces. Unit: milliseconds.', example='300'),
  order?: string(name='Order', description='The field used to sort lock diagnostics records and the sorting order.

Default value: `{"Field":"StartTime","Type":"Desc"}`, which indicates that lock diagnostics records are sorted by the start time in descending order. No other values are supported.', example='{"Field":"StartTime","Type":"Desc"}'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.', example='2021-08-03T09:30Z'),
  user?: string(name='User', description='The name of the database account.', example='testuser'),
}

model DescribeActiveSQLRecordsResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp***************'),
  queries?: [ 
    {
      clientAddr?: string(name='ClientAddr', description='The IP address of the client.', example='0.0.0.0'),
      database?: string(name='Database', description='The name of the database.', example='xg_analyse'),
      PID?: string(name='PID', description='The progress ID.', example='6164'),
      query?: string(name='Query', description='The SQL statement of the query.', example='Select * from t1,t2 where t1.id=t2.id;'),
      queryDuration?: string(name='QueryDuration', description='The execution duration of the query. Unit: seconds.', example='60s'),
      queryStart?: string(name='QueryStart', description='The start time of the query.', example='2022-05-07T06:59Z'),
      sessionID?: string(name='SessionID', description='The session ID.', example='6612'),
      sqlTruncated?: string(name='SqlTruncated', description='Indicates whether the SQL statement is truncated. Valid values:

*   true
*   false', example='false'),
      sqlTruncatedThreshold?: string(name='SqlTruncatedThreshold', description='The threshold that is used to truncate the SQL statement.', example='1024'),
      state?: string(name='State', description='The status of the asynchronous request. Valid values:

*   **running**
*   **block**', example='running'),
      user?: string(name='User', description='The name of the database account.', example='testuser'),
    }
  ](name='Queries', description='The queried SQL records.'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DescribeActiveSQLRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeActiveSQLRecordsResponseBody(name='body'),
}

/**
 * @summary Queries active SQL records.
 *
 * @param request DescribeActiveSQLRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeActiveSQLRecordsResponse
 */
async function describeActiveSQLRecordsWithOptions(request: DescribeActiveSQLRecordsRequest, runtime: Util.RuntimeOptions): DescribeActiveSQLRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.keyword)) {
    query['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.maxDuration)) {
    query['MaxDuration'] = request.maxDuration;
  }
  if (!Util.isUnset(request.minDuration)) {
    query['MinDuration'] = request.minDuration;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeActiveSQLRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries active SQL records.
 *
 * @param request DescribeActiveSQLRecordsRequest
 * @return DescribeActiveSQLRecordsResponse
 */
async function describeActiveSQLRecords(request: DescribeActiveSQLRecordsRequest): DescribeActiveSQLRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeActiveSQLRecordsWithOptions(request, runtime);
}

model DescribeAvailableResourcesRequest {
  chargeType?: string(name='ChargeType', description='The billing method. Valid values:

*   **Postpaid**: pay-as-you-go.
*   **Prepaid**: subscription.', example='PostPaid'),
  region?: string(name='Region', description='The region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  zoneId?: string(name='ZoneId', description='The zone ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent zone list.

This parameter is required.', example='cn-hangzhou-h'),
}

model DescribeAvailableResourcesResponseBody = {
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The request ID.', example='61DC563C-F8E4-593A-8D27-CE**********'),
  resources?: [ 
    {
      supportedEngines?: [ 
        {
          mode?: string(name='Mode', description='The instance resource type. Valid values:

*   **ecs**: elastic storage mode
*   **serverless**: Serverless mode', example='ecs'),
          supportedEngineVersion?: string(name='SupportedEngineVersion', description='The available engine version.', example='6.0'),
          supportedInstanceClasses?: [ 
            {
              category?: string(name='Category', description='The instance edition. Valid values:

*   **HighAvailability**: High-availability Edition
*   **Basic**: Basic Edition', example='HighAvailability'),
              description?: string(name='Description', description='The description of compute node specifications.', example='2C16G'),
              displayClass?: string(name='DisplayClass', description='The specifications of each compute node.', example='2C16G'),
              instanceClass?: string(name='InstanceClass', description='The specifications of each compute node.', example='2C16G'),
              nodeCount?: {
                maxCount?: string(name='MaxCount', description='The maximum number of compute nodes.', example='256'),
                minCount?: string(name='MinCount', description='The minimum number of compute nodes.', example='4'),
                step?: string(name='Step', description='The step size for adding compute nodes.

For example, if the value of this parameter is 4, compute nodes must be added by multiples of 4.', example='4'),
              }(name='NodeCount', description='Details about the compute nodes.'),
              storageSize?: {
                maxCount?: string(name='MaxCount', description='The maximum storage capacity of each compute node.', example='1000'),
                minCount?: string(name='MinCount', description='The minimum storage capacity of each compute node.', example='50'),
                step?: string(name='Step', description='The step size for adding storage capacity for compute nodes.', example='50'),
              }(name='StorageSize', description='Details about the storage capacity of compute nodes.'),
              storageType?: string(name='StorageType', description='The storage type. Valid values:

*   **cloud_essd**: enhanced SSD (ESSD)
*   **cloud_efficiency**: ultra disk
*   **oss**: Object Storage Service (OSS)', example='cloud_essd'),
            }
          ](name='SupportedInstanceClasses', description='The available specifications.'),
        }
      ](name='SupportedEngines', description='The available engine version and specifications.'),
      zoneId?: string(name='ZoneId', description='The ID of the zone.', example='cn-hangzhou-h'),
    }
  ](name='Resources', description='The zone ID.'),
}

model DescribeAvailableResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAvailableResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the information about available resources of AnalyticDB for PostgreSQL.
 *
 * @description When you create an AnalyticDB for PostgreSQL instance, you can call this operation to query the available resources within a zone.
 *
 * @param request DescribeAvailableResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAvailableResourcesResponse
 */
async function describeAvailableResourcesWithOptions(request: DescribeAvailableResourcesRequest, runtime: Util.RuntimeOptions): DescribeAvailableResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAvailableResources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about available resources of AnalyticDB for PostgreSQL.
 *
 * @description When you create an AnalyticDB for PostgreSQL instance, you can call this operation to query the available resources within a zone.
 *
 * @param request DescribeAvailableResourcesRequest
 * @return DescribeAvailableResourcesResponse
 */
async function describeAvailableResources(request: DescribeAvailableResourcesRequest): DescribeAvailableResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAvailableResourcesWithOptions(request, runtime);
}

model DescribeBackupJobRequest {
  backupJobId?: long(name='BackupJobId', description='This parameter is required.', example='123'),
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
}

model DescribeBackupJobResponseBody = {
  backupId?: string(name='BackupId', example='1111111111'),
  backupJobId?: string(name='BackupJobId', example='123'),
  backupMode?: string(name='BackupMode', example='Automated'),
  backupStatus?: string(name='BackupStatus', example='backup'),
  process?: string(name='Process', example='50%'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  startTime?: string(name='StartTime', example='2023-01-03T16:00:00Z'),
}

model DescribeBackupJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeBackupJobResponseBody(name='body'),
}

/**
 * @summary 获取备份任务详情
 *
 * @param request DescribeBackupJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeBackupJobResponse
 */
async function describeBackupJobWithOptions(request: DescribeBackupJobRequest, runtime: Util.RuntimeOptions): DescribeBackupJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupJobId)) {
    query['BackupJobId'] = request.backupJobId;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取备份任务详情
 *
 * @param request DescribeBackupJobRequest
 * @return DescribeBackupJobResponse
 */
async function describeBackupJob(request: DescribeBackupJobRequest): DescribeBackupJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupJobWithOptions(request, runtime);
}

model DescribeBackupPolicyRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
}

model DescribeBackupPolicyResponseBody = {
  backupRetentionPeriod?: int32(name='BackupRetentionPeriod', description='The number of days for which data backup files are retained.', example='7'),
  enableRecoveryPoint?: boolean(name='EnableRecoveryPoint', description='Indicates whether automatic point-in-time backup is enabled. Valid values:

*   **true**: Automatic point-in-time backup is enabled.
*   **false**: Automatic point-in-time backup is disabled.', example='true'),
  preferredBackupPeriod?: string(name='PreferredBackupPeriod', description='The cycle based on which backups are performed. If more than one day of the week is specified, the days of the week are separated by commas (,). Valid values:

*   **Monday**
*   **Tuesday**
*   **Wednesday**
*   **Thursday**
*   **Friday**
*   **Saturday**
*   **Sunday**', example='Wednesday,Friday'),
  preferredBackupTime?: string(name='PreferredBackupTime', description='The backup time. The time is in the HH:mmZ-HH:mmZ format. The time is displayed in UTC.', example='12:00Z-13:00Z'),
  recoveryPointPeriod?: string(name='RecoveryPointPeriod', description='The frequency of the point-in-time backup. Valid values:

*   **1**: per hour
*   **2**: per 2 hours
*   **4**: per 4 hours
*   **8**: per 8 hours', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9E6B3287-A3E2-5A87-B8D8-E9**********'),
}

model DescribeBackupPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeBackupPolicyResponseBody(name='body'),
}

/**
 * @summary Queries the backup policy of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the backup settings of an AnalyticDB for PostgreSQL instance in elastic storage mode. Periodically backing data can prevent data loss. For more information about how to modify backup policies, see [ModifyBackupPolicy](https://help.aliyun.com/document_detail/210095.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeBackupPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeBackupPolicyResponse
 */
async function describeBackupPolicyWithOptions(request: DescribeBackupPolicyRequest, runtime: Util.RuntimeOptions): DescribeBackupPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupPolicy',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the backup policy of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the backup settings of an AnalyticDB for PostgreSQL instance in elastic storage mode. Periodically backing data can prevent data loss. For more information about how to modify backup policies, see [ModifyBackupPolicy](https://help.aliyun.com/document_detail/210095.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeBackupPolicyRequest
 * @return DescribeBackupPolicyResponse
 */
async function describeBackupPolicy(request: DescribeBackupPolicyRequest): DescribeBackupPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupPolicyWithOptions(request, runtime);
}

model DescribeCollectionRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model DescribeCollectionResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  dimension?: int32(name='Dimension', description='The number of vector dimensions.', example='1024'),
  fullTextRetrievalFields?: string(name='FullTextRetrievalFields', description='The fields that are used for full-text search. Multiple fields are separated by commas (,).', example='title,content'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  metadata?: map[string]string(name='Metadata', description='The metadata of vector data, which is a JSON string in the MAP format. The key specifies the field name, and the value specifies the data type.

**

**Warning** Reserved fields such as id, vector, and to_tsvector cannot be used.'),
  metrics?: string(name='Metrics', description='The distance metrics.', example='cosine'),
  namespace?: string(name='Namespace', description='The name of the namespace.', example='mynamespace'),
  parser?: string(name='Parser', description='The analyzer that is used for full-text search.', example='zh_cn'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  sparseVectorMetrics?: string(name='SparseVectorMetrics'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
  supportSparse?: boolean(name='SupportSparse'),
}

model DescribeCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCollectionResponseBody(name='body'),
}

/**
 * @summary Queries the information about a vector collection.
 *
 * @param request DescribeCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCollectionResponse
 */
async function describeCollectionWithOptions(request: DescribeCollectionRequest, runtime: Util.RuntimeOptions): DescribeCollectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a vector collection.
 *
 * @param request DescribeCollectionRequest
 * @return DescribeCollectionResponse
 */
async function describeCollection(request: DescribeCollectionRequest): DescribeCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCollectionWithOptions(request, runtime);
}

model DescribeCreateIndexJobRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='This parameter is required.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model DescribeCreateIndexJobResponseBody = {
  job?: {
    completed?: boolean(name='Completed', example='false'),
    createTime?: string(name='CreateTime', example='2024-01-08 16:52:04.864664'),
    error?: string(name='Error', example='Failed to connect database.'),
    id?: string(name='Id', description='Job ID。', example='231460f8-75dc-405e-a669-0c5204887e91'),
    progress?: int32(name='Progress', example='20'),
    status?: string(name='Status', example='Running'),
    updateTime?: string(name='UpdateTime', example='2024-01-08 16:53:04.864664'),
  }(name='Job'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model DescribeCreateIndexJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCreateIndexJobResponseBody(name='body'),
}

/**
 * @summary 获取创建索引任务
 *
 * @param request DescribeCreateIndexJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCreateIndexJobResponse
 */
async function describeCreateIndexJobWithOptions(request: DescribeCreateIndexJobRequest, runtime: Util.RuntimeOptions): DescribeCreateIndexJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCreateIndexJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取创建索引任务
 *
 * @param request DescribeCreateIndexJobRequest
 * @return DescribeCreateIndexJobResponse
 */
async function describeCreateIndexJob(request: DescribeCreateIndexJobRequest): DescribeCreateIndexJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCreateIndexJobWithOptions(request, runtime);
}

model DescribeDBClusterNodeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  nodeType?: string(name='NodeType', description='The node type. Valid values:

*   **master**: coordinator node.
*   **segment**: compute node.

> If you do not specify this parameter, the information about all nodes is returned.', example='master'),
}

model DescribeDBClusterNodeResponseBody = {
  DBClusterId?: string(name='DBClusterId', description='The instance ID.', example='gp-bp***************'),
  nodes?: [ 
    {
      name?: string(name='Name', description='The name of the node.', example='master-10*******'),
    }
  ](name='Nodes', description='The name of the node.'),
  requestId?: string(name='RequestId', description='The request ID.', example='87E44B48-B306-4AD3-A63B-C8**********'),
}

model DescribeDBClusterNodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBClusterNodeResponseBody(name='body'),
}

/**
 * @summary Queries a list of nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @description ##
 * You can call this operation to query the information about coordinator and compute nodes in an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBClusterNodeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBClusterNodeResponse
 */
async function describeDBClusterNodeWithOptions(request: DescribeDBClusterNodeRequest, runtime: Util.RuntimeOptions): DescribeDBClusterNodeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.nodeType)) {
    query['NodeType'] = request.nodeType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBClusterNode',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @description ##
 * You can call this operation to query the information about coordinator and compute nodes in an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBClusterNodeRequest
 * @return DescribeDBClusterNodeResponse
 */
async function describeDBClusterNode(request: DescribeDBClusterNodeRequest): DescribeDBClusterNodeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBClusterNodeWithOptions(request, runtime);
}

model DescribeDBClusterPerformanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the `YYYY-MM-DDTHH:mmZ` format.

> The end time must be later than the start time. The maximum time range that can be specified is seven days.

This parameter is required.', example='2021-11-03T15:10Z'),
  key?: string(name='Key', description='The performance metric that you want to query. Separate multiple values with commas (,). For more information, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).

This parameter is required.', example='adbpg_conn_count'),
  nodeType?: string(name='NodeType', description='The node type. Valid values:

*   **master**: coordinator node.
*   **segment**: compute node.

> If you do not specify this parameter, the performance metrics of all nodes are returned.', example='master'),
  nodes?: string(name='Nodes', description='The nodes for which you want to query performance metrics. Separate multiple values with commas (,). Example: `master-10******1,master-10******2`. You can call the [DescribeDBClusterNode](https://help.aliyun.com/document_detail/390136.html) operation to query the names of nodes.

You can also filter the nodes based on their metric values. Valid values:

*   **top10**: the 10 nodes that have the highest metric values.
*   **top20**: the 20 nodes that have the highest metric values.
*   **bottom10**: the 10 nodes that have the lowest metric values.
*   **bottom20**: the 20 nodes that have the lowest metric values.', example='top10'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.', example='testgroup'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the `YYYY-MM-DDTHH:mmZ` format.

> You can query monitoring information only within the last 30 days.

This parameter is required.', example='2021-11-03T15:00Z'),
}

model DescribeDBClusterPerformanceResponseBody = {
  DBClusterId?: string(name='DBClusterId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end time of the query. The time follows the ISO 8601 standard in the `YYYY-MM-DDTHH:mmZ` format. The time is displayed in UTC.', example='2021-11-03T15:10Z'),
  performanceKeys?: [ 
    {
      name?: string(name='Name', description='The name of the performance metric. For more information, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).', example='adbpg_group_cpu_used_percent'),
      series?: [ 
        {
          name?: string(name='Name', description='The name of the compute node or compute group.', example='standby-********-cpu'),
          role?: string(name='Role', description='The role of the node. Valid values:

*   **master**: primary coordinator node
*   **standby**: standby coordinator node
*   **segment**: compute node', example='standby'),
          values?: [ 
            {
              point?: [ string ](name='Point', description='The value of the performance metric and the time when the metric value was collected.'),
            }
          ](name='Values', description='The value of the performance metric collected at a point in time.'),
        }
      ](name='Series', description='Details of the performance metric of a node.'),
      unit?: string(name='Unit', description='The unit of the performance metric.', example='%'),
    }
  ](name='PerformanceKeys', description='The name of the performance metric. For more information, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).'),
  requestId?: string(name='RequestId', description='The request ID.', example='8E8990F0-C81E-4C94-8F51-5F**********'),
  startTime?: string(name='StartTime', description='The start time of the query. The time follows the ISO 8601 standard in the `YYYY-MM-DDTHH:mmZ` format. The time is displayed in UTC.', example='2021-11-03T15:00Z'),
}

model DescribeDBClusterPerformanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBClusterPerformanceResponseBody(name='body'),
}

/**
 * @summary Queries the information about performance metrics of an AnalyticDB for PostgreSQL instance within a time range.
 *
 * @description You can query monitoring information only within the last 30 days.
 *
 * @param request DescribeDBClusterPerformanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBClusterPerformanceResponse
 */
async function describeDBClusterPerformanceWithOptions(request: DescribeDBClusterPerformanceRequest, runtime: Util.RuntimeOptions): DescribeDBClusterPerformanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.nodeType)) {
    query['NodeType'] = request.nodeType;
  }
  if (!Util.isUnset(request.nodes)) {
    query['Nodes'] = request.nodes;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBClusterPerformance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about performance metrics of an AnalyticDB for PostgreSQL instance within a time range.
 *
 * @description You can query monitoring information only within the last 30 days.
 *
 * @param request DescribeDBClusterPerformanceRequest
 * @return DescribeDBClusterPerformanceResponse
 */
async function describeDBClusterPerformance(request: DescribeDBClusterPerformanceRequest): DescribeDBClusterPerformanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBClusterPerformanceWithOptions(request, runtime);
}

model DescribeDBInstanceAttributeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) interface to view the instance IDs of all AnalyticDB for PostgreSQL instances in the target region.

This parameter is required.', example='gp-bp13ue79qk8y1****'),
  ownerId?: long(name='OwnerId'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is deprecated and should not be passed.', example='null'),
}

model DescribeDBInstanceAttributeResponseBody = {
  items?: {
    DBInstanceAttribute?: [ 
    {
      availabilityValue?: string(name='AvailabilityValue', description='Queries the current instance availability status, in percentage (%).

> This parameter is only applicable to instances in the storage reserved mode.', example='100.0%'),
      connectionMode?: string(name='ConnectionMode', description='Access mode, with the following values:

- **Performance**: Standard access mode.
- **Safty**: High-security access mode.
- **LVS**: LVS link mode.', example='LVS'),
      connectionString?: string(name='ConnectionString', description='Instance connection address.', example='gp-bp13ue79qk8y1****-master.gpdb.rds.aliyuncs.com'),
      coreVersion?: string(name='CoreVersion', description='Minor version number of the kernel.', example='mm.v6.3.10.1-202207141918'),
      cpuCores?: int32(name='CpuCores', description='Number of CPU cores for the compute node, unit: Core.', example='2'),
      cpuCoresPerNode?: int32(name='CpuCoresPerNode', description='Number of CPU cores per node.

> This parameter is only applicable to instances in the storage reserved mode.', example='0'),
      creationTime?: string(name='CreationTime', description='Instance creation time.', example='2022-08-11T09:16:26Z'),
      DBInstanceCategory?: string(name='DBInstanceCategory', description='Instance series, with the following values:

- **Basic**: Basic Edition.
- **HighAvailability**: High Availability Edition.', example='HighAvailability'),
      DBInstanceClass?: string(name='DBInstanceClass', description='Instance specification.

> This parameter is only applicable to reserved storage mode instances.', example='gpdb.group.segsdx1'),
      DBInstanceClassType?: string(name='DBInstanceClassType', description='Instance family, with the following values:

- **s**: Shared type.
- **x**: General type.
- **d**: Dedicated package.
- **h**: Dedicated physical machine.', example='x'),
      DBInstanceCpuCores?: int32(name='DBInstanceCpuCores', description='Number of CPU cores.', example='2'),
      DBInstanceDescription?: string(name='DBInstanceDescription', description='Instance description.', example='gp-bp13ue79qk8y1****'),
      DBInstanceDiskMBPS?: long(name='DBInstanceDiskMBPS', description='Maximum BPS (disk throughput) of the compute group, in Mbps.

> This parameter is only applicable to reserved storage mode instances.', example='0'),
      DBInstanceGroupCount?: string(name='DBInstanceGroupCount', description='Number of compute groups.

> This parameter is only applicable to reserved storage mode instances.', example='0'),
      DBInstanceId?: string(name='DBInstanceId', description='Instance ID.', example='gp-bp13ue79qk8y1****'),
      DBInstanceMemory?: long(name='DBInstanceMemory', description='Memory of the compute node.

> The unit for storage-reserved mode is MB; for Serverless and storage-elastic modes, it is GB.', example='16'),
      DBInstanceMode?: string(name='DBInstanceMode', description='Instance resource type, with the following values:

- **Serverless**: Serverless mode.
- **StorageElastic**: Storage elastic mode.
- **Classic**: Storage reserved mode.', example='StorageElastic'),
      DBInstanceNetType?: string(name='DBInstanceNetType', description='This parameter is deprecated and will not return any value.', example='null'),
      DBInstanceStatus?: string(name='DBInstanceStatus', description='Instance status. For more details, see the supplementary explanation of the DBInstanceStatus parameter.', example='Running'),
      DBInstanceStorage?: long(name='DBInstanceStorage', description='Maximum storage space of a single replica, in GB.', example='50'),
      deployMode?: string(name='DeployMode', description='The deployment mode.', example='single'),
      encryptionKey?: string(name='EncryptionKey', description='Encryption key.

> This parameter is returned only for instances with disk encryption enabled.', example='0d2470df-da7b-4786-b981-************'),
      encryptionType?: string(name='EncryptionType', description='Encryption type, with the following value:

- **CloudDisk**: Cloud disk encryption.

> This parameter is returned only for instances with cloud disk encryption.', example='CloudDisk'),
      engine?: string(name='Engine', description='Database engine.', example='gpdb'),
      engineVersion?: string(name='EngineVersion', description='Database version.', example='6.0'),
      expireTime?: string(name='ExpireTime', description='Instance expiration time (in UTC).

> The expiration time for pay-as-you-go instances is `2999-09-08T16:00:00Z`.', example='2999-09-08T16:00:00Z'),
      hostType?: string(name='HostType', description='Compute group machine type, with the following values:
- **0**: SSD
- **1**: HDD

> This parameter applies only to storage-reserved mode instances.', example='0'),
      idleTime?: int32(name='IdleTime', description='Idle release waiting time. Unit: seconds.

> This parameter is returned only for instances in the Serverless automatic scheduling mode.', example='600'),
      instanceNetworkType?: string(name='InstanceNetworkType', description='Instance network type, with the following values:

- **Classic**: Classic network.
- **VPC**: VPC network.', example='VPC'),
      lockMode?: string(name='LockMode', description='Lock mode, with the following values:

- **Unlock**: Normal.
- **ManualLock**: Manually triggered lock.
- **LockByExpiration**: Automatically locked when the instance expires.
- **LockByRestoration**: Automatically locked before the instance rolls back.
- **LockByDiskQuota**: Automatically locked when the instance space is full.', example='Unlock'),
      lockReason?: string(name='LockReason', description='This parameter is deprecated and will not return any value.', example='null'),
      maintainEndTime?: string(name='MaintainEndTime', description='Maintenance end time.', example='22:00Z'),
      maintainStartTime?: string(name='MaintainStartTime', description='Maintenance start time.', example='18:00Z'),
      masterAISpec?: string(name='MasterAISpec', description='The specifications of AI coordinator node resources of the instance. If the coordinator nodes of the instance are not AI nodes, null is returned.', example='ADB.AIMedium.2'),
      masterCU?: int32(name='MasterCU', description='Master resources.', example='4'),
      masterNodeNum?: int32(name='MasterNodeNum', description='Number of Master nodes.', example='1'),
      maxConnections?: int32(name='MaxConnections', description='Maximum number of concurrent connections for the instance.

> This parameter is only applicable to reserved storage mode instances.', example='500'),
      memoryPerNode?: int32(name='MemoryPerNode', description='Memory size per replica, see the **MemoryUnit** parameter for the unit.

> This parameter is only applicable to instances in the storage reserved mode.', example='0'),
      memorySize?: long(name='MemorySize', description='Memory size of the compute node.

> The unit is MB for the storage reserved mode; GB for Serverless and storage elastic modes.', example='16'),
      memoryUnit?: string(name='MemoryUnit', description='Memory unit.

> This parameter is only applicable to reserved storage mode instances.', example='GB'),
      minorVersion?: string(name='MinorVersion', description='Minor version of the kernel.', example='6.3.10.1-202207141918'),
      payType?: string(name='PayType', description='Billing type, with the following values:

- **Postpaid**: Pay-as-you-go.
- **Prepaid**: Subscription.', example='Postpaid'),
      port?: string(name='Port', description='Instance port number.', example='5432'),
      prodType?: string(name='ProdType', description='The service type.', example='standard'),
      readDelayTime?: string(name='ReadDelayTime', description='This parameter has been deprecated and will not return a value.', example='null'),
      regionId?: string(name='RegionId', description='Region ID.', example='cn-hangzhou'),
      resourceGroupId?: string(name='ResourceGroupId', description='ID of the resource group where the instance is located.', example='rg-bp67acfmxazb4p****'),
      runningTime?: string(name='RunningTime', description='Instance running time.', example='4 days 22:58:55'),
      securityIPList?: string(name='SecurityIPList', description='This parameter is deprecated and will not return any value.', example='null'),
      segDiskPerformanceLevel?: string(name='SegDiskPerformanceLevel', description='Performance Level (PL), currently only **PL1** is supported.', example='PL1'),
      segNodeNum?: int32(name='SegNodeNum', description='Number of Segment nodes.

> This parameter applies only to instances in the storage elastic mode and Serverless manual scheduling mode.', example='4'),
      segmentAISpec?: string(name='SegmentAISpec', description='The specifications of AI compute node resources of the instance. If the compute nodes of the instance are not AI nodes, null is returned.', example='ADB.AIMedium.2'),
      segmentCounts?: int32(name='SegmentCounts', description='Number of compute groups.

> This parameter applies only to storage-reserved mode instances.', example='0'),
      serverlessMode?: string(name='ServerlessMode', description='The mode of the Serverless instance, with the following values:

- **Manual**: Manual scheduling.
- **Auto**: Automatic scheduling.

> This parameter is returned only for Serverless mode instances.', example='Auto'),
      serverlessResource?: int32(name='ServerlessResource', description='Compute resource threshold. Unit: ACU.

> This parameter is returned only for instances in the Serverless automatic scheduling mode.', example='32'),
      standbyZoneId?: string(name='StandbyZoneId', description='The secondary zone ID.', example='cn-hangzhou-i'),
      startTime?: string(name='StartTime', description='The time when the instance started running.', example='2022-08-11T09:26:43Z'),
      storagePerNode?: int32(name='StoragePerNode', description='Storage size per replica, see the **StorageUnit** parameter for units.

> This parameter applies only to storage-reserved mode instances.', example='0'),
      storageSize?: long(name='StorageSize', description='Storage space size, unit: GB.', example='50'),
      storageType?: string(name='StorageType', description='Storage type, with the following values:

- **cloud_essd**: ESSD cloud disk.
- **cloud_efficiency**: Efficient cloud disk.

> This parameter is only applicable to instances in the storage elastic mode.', example='cloud_essd'),
      storageUnit?: string(name='StorageUnit', description='Storage unit, with the following values:

- **GB SSD**
- **TB SSD**
- **GB HDD**

> This parameter is only applicable to instances in the storage reserved mode.', example='GB SSD'),
      supportRestore?: boolean(name='SupportRestore', description='Indicates whether backup recovery is supported, with the following values:

- **true**: Backup recovery is supported.
- **false**: Backup recovery is not supported.', example='true'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='Tag key.', example='test-key'),
          value?: string(name='Value', description='Tag value.', example='test-value'),
        }
      ](name='Tag')
      }(name='Tags', description='Tag key-value pairs.'),
      vSwitchId?: string(name='VSwitchId', description='vSwitch ID.', example='vsw-bp1cpq8mr64paltkb****'),
      vectorConfigurationStatus?: string(name='VectorConfigurationStatus', description='Indicates whether vector engine optimization is enabled. The values are as follows:
- **enabled**: Indicates that vector engine optimization is enabled.
- **disabled**: Indicates that vector engine optimization is disabled.', example='enabled'),
      vpcId?: string(name='VpcId', description='VPC ID.', example='vpc-bp19ame5m1r3oejns****'),
      zoneId?: string(name='ZoneId', description='Zone ID.', example='cn-hangzhou-j'),
    }
  ](name='DBInstanceAttribute')
  }(name='Items', description='The queried instance.'),
  requestId?: string(name='RequestId', description='Request ID.', example='5E6EDEB8-D73E-5F2D-B948-86C8AEB05A68'),
}

model DescribeDBInstanceAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceAttributeResponseBody(name='body'),
}

/**
 * @summary Query detailed information about the instance.
 *
 * @description ## Usage Instructions
 * This interface is generally used to view information such as the specifications, network type, and instance status of AnalyticDB for PostgreSQL instances.
 * ## QPS Limitation
 * The default single-user QPS limit for this interface is 1000 times/second. If the limit is exceeded, API calls will be throttled, which may affect your business. Please use it reasonably.
 * <props="china">The QPS in this document is only a default reference value. For accurate information, please refer to the [API Rate Quota List](https://quotas.console.aliyun.com/flow-control-products/gpdb/quotas).
 *
 * @param request DescribeDBInstanceAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceAttributeResponse
 */
async function describeDBInstanceAttributeWithOptions(request: DescribeDBInstanceAttributeRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceAttribute',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Query detailed information about the instance.
 *
 * @description ## Usage Instructions
 * This interface is generally used to view information such as the specifications, network type, and instance status of AnalyticDB for PostgreSQL instances.
 * ## QPS Limitation
 * The default single-user QPS limit for this interface is 1000 times/second. If the limit is exceeded, API calls will be throttled, which may affect your business. Please use it reasonably.
 * <props="china">The QPS in this document is only a default reference value. For accurate information, please refer to the [API Rate Quota List](https://quotas.console.aliyun.com/flow-control-products/gpdb/quotas).
 *
 * @param request DescribeDBInstanceAttributeRequest
 * @return DescribeDBInstanceAttributeResponse
 */
async function describeDBInstanceAttribute(request: DescribeDBInstanceAttributeRequest): DescribeDBInstanceAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceAttributeWithOptions(request, runtime);
}

model DescribeDBInstanceDataBloatRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='test'),
  orderBy?: string(name='OrderBy', description='The sorting order.', example='{Field: TableName, Type: Desc}'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. The value must be an integer that is greater than 0. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
}

model DescribeDBInstanceDataBloatResponseBody = {
  items?: [ 
    {
      bloatCeoff?: string(name='BloatCeoff', description='The coefficient of data bloat. It is calculated by using the following formula:

Bloat coefficient = Number of dead rows/Number of active rows.', example='1.03'),
      bloatSize?: string(name='BloatSize', description='The bloat size of the table. It indicates the amount of space that can be released.', example='0.2MB'),
      databaseName?: string(name='DatabaseName', description='The name of the database.', example='adbtest'),
      expectTableSize?: string(name='ExpectTableSize', description='The expected size of the table.

It indicates the size of the table that has no data bloat.', example='1MB'),
      realTableSize?: string(name='RealTableSize', description='The actual size of the table.', example='1.2MB'),
      schemaName?: string(name='SchemaName', description='The name of the schema.', example='schema1'),
      sequence?: int32(name='Sequence', description='The sequence number.', example='1'),
      storageType?: string(name='StorageType', description='The storage type of the table. Valid values:

*   **Heap Table**
*   **Append-Only Heap Table**
*   **Append-Only Columnar Table**', example='Heap Table'),
      suggestedAction?: string(name='SuggestedAction', description='This parameter is not returned.', example='null'),
      tableName?: string(name='TableName', description='The name of the table.', example='tab1'),
      timeLastUpdated?: string(name='TimeLastUpdated', description='The time when the table was last deleted, inserted, or updated.', example='2022-08-08T20:00:00Z'),
      timeLastVacuumed?: string(name='TimeLastVacuumed', description='The time when the table was last vacuumed. The time is displayed in UTC.', example='2022-08-08T16:00:00Z'),
    }
  ](name='Items', description='The queried data bloat.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries.', example='1'),
}

model DescribeDBInstanceDataBloatResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceDataBloatResponseBody(name='body'),
}

/**
 * @summary Queries the information about data bloat for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of data bloat on an AnalyticDB for PostgreSQL instance in elastic storage mode. The minor version of the instance must be V6.3.10.1 or later. For more information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceDataBloatRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceDataBloatResponse
 */
async function describeDBInstanceDataBloatWithOptions(request: DescribeDBInstanceDataBloatRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceDataBloatResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceDataBloat',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about data bloat for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of data bloat on an AnalyticDB for PostgreSQL instance in elastic storage mode. The minor version of the instance must be V6.3.10.1 or later. For more information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceDataBloatRequest
 * @return DescribeDBInstanceDataBloatResponse
 */
async function describeDBInstanceDataBloat(request: DescribeDBInstanceDataBloatRequest): DescribeDBInstanceDataBloatResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceDataBloatWithOptions(request, runtime);
}

model DescribeDBInstanceDataSkewRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='test'),
  orderBy?: string(name='OrderBy', description='order by condition', example='{Field: TableSkew, Type: Desc}'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. The value must be an integer that is greater than 0. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='20'),
}

model DescribeDBInstanceDataSkewResponseBody = {
  items?: [ 
    {
      databaseName?: string(name='DatabaseName', description='The name of the database.', example='adbtest'),
      distributeKey?: string(name='DistributeKey', description='The distribution key of the table.', example='ItemId'),
      owner?: string(name='Owner', description='The owner of the table.', example='adbpguser'),
      schemaName?: string(name='SchemaName', description='The name of the schema.', example='schema1'),
      sequence?: int32(name='Sequence', description='The sequence number of the data skew case. All data skew cases are sorted by severity in descending order.', example='1'),
      tableName?: string(name='TableName', description='The name of the table.', example='tab1'),
      tableSize?: string(name='TableSize', description='The total number of rows in the table.', example='100000'),
      tableSkew?: string(name='TableSkew', description='The skew ratio of the table. Valid values: 0 to 100. Unit: %. A greater value indicates that the table is more severely skewed. A smaller value indicates less impact on query performance. A value of 0 indicates no data skew.', example='10.23'),
      timeLastUpdated?: string(name='TimeLastUpdated', description='The time when the table was last deleted, inserted, or updated.', example='2020-09-08T20:00:00Z'),
    }
  ](name='Items', description='Details about data skew.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='100'),
}

model DescribeDBInstanceDataSkewResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceDataSkewResponseBody(name='body'),
}

/**
 * @summary Queries the information about data skew for an AnalyticDB for PostgreSQL instance.
 *
 * @description To prevent data skew from affecting your database service, you can call this operation to query the details about data skew on an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceDataSkewRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceDataSkewResponse
 */
async function describeDBInstanceDataSkewWithOptions(request: DescribeDBInstanceDataSkewRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceDataSkewResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceDataSkew',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about data skew for an AnalyticDB for PostgreSQL instance.
 *
 * @description To prevent data skew from affecting your database service, you can call this operation to query the details about data skew on an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceDataSkewRequest
 * @return DescribeDBInstanceDataSkewResponse
 */
async function describeDBInstanceDataSkew(request: DescribeDBInstanceDataSkewRequest): DescribeDBInstanceDataSkewResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceDataSkewWithOptions(request, runtime);
}

model DescribeDBInstanceDiagnosisSummaryRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **20**
*   **50**
*   **100**

Default value: **20**.', example='20'),
  rolePreferd?: string(name='RolePreferd', description='The role state of the node. It specifies whether a primary/secondary switchover occurs. Valid values:

*   **normal**: The node role is normal. No primary/secondary switchover occurs.
*   **reverse**: The node role is reversed. A primary/secondary switchover occurs.', example='normal'),
  startStatus?: string(name='StartStatus', description='The running state of the node. Valid values:

*   **UP**: The node is running.
*   **DOWN**: The node is faulty.

If you do not specify this parameter, the information about nodes in all running states is returned.', example='UP'),
  syncMode?: string(name='SyncMode', description='The data synchronization state of the node. Valid values:

*   **synced**: The node data is synchronized.
*   **notSyncing**: The node data is not synchronized.

If you do not specify this parameter, the information about nodes in all synchronization states is returned.', example='synced'),
}

model DescribeDBInstanceDiagnosisSummaryResponseBody = {
  items?: [ 
    {
      hostname?: string(name='Hostname', description='The name of the node.', example='gp-t4np568qe9710****-master-100984919'),
      nodeAddress?: string(name='NodeAddress', description='The IP address of the node.', example='192.168.XX.XX'),
      nodeCID?: string(name='NodeCID', description='The node group ID.', example='-1'),
      nodeID?: string(name='NodeID', description='The node ID.', example='1'),
      nodeName?: string(name='NodeName', description='The name of the host where the node resides.', example='ap-southeast-1.i-t4n4c4ryr0yr441d****'),
      nodePort?: string(name='NodePort', description='The port number of the node.', example='3000'),
      nodePreferredRole?: string(name='NodePreferredRole', description='The initial role of the node. Valid values:

*   **primary**: primary node.
*   **mirror**: secondary node.

If the value of this parameter is the same as that of **NodeRole**, no primary/secondary switchover occurs. If the value of this parameter is different from that of **NodeRole**, a primary/secondary switchover occurs.', example='primary'),
      nodeReplicationMode?: string(name='NodeReplicationMode', description='The data synchronization state of the node. Valid values:

*   **Synced**: The node data is synchronized.
*   **Not Syncing**: The node data is not synchronized.
*   **No sync required**: Data synchronization is not required. This value may be returned only for the coordinator node.', example='Synced'),
      nodeRole?: string(name='NodeRole', description='The current role of the node. Valid values:

*   **primary**: primary node.
*   **mirror**: secondary node.', example='primary'),
      nodeStatus?: string(name='NodeStatus', description='The running state of the node. Valid values:

*   **UP**: The node is running.
*   **DOWN**: The node is faulty.', example='UP'),
      nodeType?: string(name='NodeType', description='The type of the node. Valid values:

*   **master**: primary coordinator node.
*   **slave**: standby coordinator node.
*   **segment**: compute node.', example='master'),
    }
  ](name='Items', description='The group ID.'),
  masterStatusInfo?: {
    exceptionNodeNum?: int32(name='ExceptionNodeNum', description='The number of abnormal nodes.', example='0'),
    normalNodeNum?: int32(name='NormalNodeNum', description='The number of normal nodes.', example='2'),
    notPreferredNodeNum?: int32(name='NotPreferredNodeNum', description='The number of nodes whose roles are reversed.', example='0'),
    notSyncingNodeNum?: int32(name='NotSyncingNodeNum', description='The number of unsynchronized nodes.', example='0'),
    preferredNodeNum?: int32(name='PreferredNodeNum', description='The number of nodes whose roles are normal.', example='2'),
    syncedNodeNum?: int32(name='SyncedNodeNum', description='The number of synchronized nodes.', example='1'),
  }(name='MasterStatusInfo', description='The state information about the coordinator node.'),
  pageNumber?: string(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='070534EC-78D5-5519-83CC-E7B1A9213483'),
  segmentStatusInfo?: {
    exceptionNodeNum?: int32(name='ExceptionNodeNum', description='The number of abnormal nodes.', example='0'),
    normalNodeNum?: int32(name='NormalNodeNum', description='The number of normal nodes.', example='4'),
    notPreferredNodeNum?: int32(name='NotPreferredNodeNum', description='The number of nodes whose roles are reversed.', example='0'),
    notSyncingNodeNum?: int32(name='NotSyncingNodeNum', description='The number of unsynchronized nodes.', example='4'),
    preferredNodeNum?: int32(name='PreferredNodeNum', description='The number of nodes whose roles are normal.', example='4'),
    syncedNodeNum?: int32(name='SyncedNodeNum', description='The number of synchronized nodes.', example='0'),
  }(name='SegmentStatusInfo', description='The state information about compute nodes.'),
  totalCount?: string(name='TotalCount', description='The total number of entries returned.', example='6'),
}

model DescribeDBInstanceDiagnosisSummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceDiagnosisSummaryResponseBody(name='body'),
}

/**
 * @summary Queries the information about nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the distribution and states of coordinator and compute nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceDiagnosisSummaryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceDiagnosisSummaryResponse
 */
async function describeDBInstanceDiagnosisSummaryWithOptions(request: DescribeDBInstanceDiagnosisSummaryRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceDiagnosisSummaryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.rolePreferd)) {
    query['RolePreferd'] = request.rolePreferd;
  }
  if (!Util.isUnset(request.startStatus)) {
    query['StartStatus'] = request.startStatus;
  }
  if (!Util.isUnset(request.syncMode)) {
    query['SyncMode'] = request.syncMode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceDiagnosisSummary',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the distribution and states of coordinator and compute nodes in an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceDiagnosisSummaryRequest
 * @return DescribeDBInstanceDiagnosisSummaryResponse
 */
async function describeDBInstanceDiagnosisSummary(request: DescribeDBInstanceDiagnosisSummaryRequest): DescribeDBInstanceDiagnosisSummaryResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceDiagnosisSummaryWithOptions(request, runtime);
}

model DescribeDBInstanceErrorLogRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='adbtest'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC. The end time must be later than the start time.', example='2022-04-25T06:59Z'),
  host?: string(name='Host', description='This parameter is not supported in Alibaba Cloud public cloud.', example='null'),
  keywords?: string(name='Keywords', description='One or more keywords that are used to query error logs.', example='error'),
  logLevel?: string(name='LogLevel', description='The level of the logs to query. Valid values:

*   **ALL**: queries all error logs.
*   **PANIC**: queries only abnormal logs.
*   **FATAL**: queries only critical logs.
*   **ERROR**: queries only error logs.', example='ALL'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **20**
*   **50**
*   **100**

Default value: **20**.', example='20'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-04-24T06:59Z'),
  user?: string(name='User', description='The username.', example='adbpguser'),
}

model DescribeDBInstanceErrorLogResponseBody = {
  items?: [ 
    {
      database?: string(name='Database', description='The name of the database.', example='adbtest'),
      host?: string(name='Host', description='This parameter is not supported.', example='null'),
      logContext?: string(name='LogContext', description='The content of the error log.', example='unsupported frontend protocol 2689.28208: server supports 1.0 to 3.0'),
      logLevel?: string(name='LogLevel', description='The level of the queried log.', example='FATAL'),
      time?: long(name='Time', description='The time when the log was generated. The time is displayed in UTC.', example='2022-04-24 11:28:14'),
      user?: string(name='User', description='The name of the database account.', example='adbpguser'),
    }
  ](name='Items', description='The content of the error log.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeDBInstanceErrorLogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceErrorLogResponseBody(name='body'),
}

/**
 * @summary Queries the error logs of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the error logs of an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceErrorLogRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceErrorLogResponse
 */
async function describeDBInstanceErrorLogWithOptions(request: DescribeDBInstanceErrorLogRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceErrorLogResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.host)) {
    query['Host'] = request.host;
  }
  if (!Util.isUnset(request.keywords)) {
    query['Keywords'] = request.keywords;
  }
  if (!Util.isUnset(request.logLevel)) {
    query['LogLevel'] = request.logLevel;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceErrorLog',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the error logs of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the error logs of an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceErrorLogRequest
 * @return DescribeDBInstanceErrorLogResponse
 */
async function describeDBInstanceErrorLog(request: DescribeDBInstanceErrorLogRequest): DescribeDBInstanceErrorLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceErrorLogWithOptions(request, runtime);
}

model DescribeDBInstanceIPArrayListRequest {
  DBInstanceIPArrayName?: string(name='DBInstanceIPArrayName', description='The name of the IP address whitelist. If you do not specify this parameter, the default whitelist is queried.

>  Each instance supports up to 50 IP address whitelists.', example='Default'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
}

model DescribeDBInstanceIPArrayListResponseBody = {
  items?: {
    DBInstanceIPArray?: [ 
    {
      DBInstanceIPArrayAttribute?: string(name='DBInstanceIPArrayAttribute', description='The attribute of the IP address whitelist. By default, this parameter is empty. A whitelist with the `hidden` attribute is not displayed in the console.', example='hidden'),
      DBInstanceIPArrayName?: string(name='DBInstanceIPArrayName', description='The name of the IP address whitelist.', example='default'),
      securityIPList?: string(name='SecurityIPList', description='The IP addresses listed in the whitelist. Up to 1,000 IP addresses are contained in a whitelist and separated by commas (,). The IP addresses must use one of the following formats:

*   0.0.0.0/0
*   10.23.12.24. This is a standard IP address.
*   10.23.12.24/24. This is a CIDR block. The value `/24` indicates that the prefix of the CIDR block is 24-bit long. You can replace 24 with a value in the range of `1 to 32`.', example='127.0.0.1'),
    }
  ](name='DBInstanceIPArray')
  }(name='Items', description='The queried IP address whitelists.'),
  requestId?: string(name='RequestId', description='The request ID.', example='CB7AA0BF-BE41-480E-A3DC-C97BF85A391B'),
}

model DescribeDBInstanceIPArrayListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceIPArrayListResponseBody(name='body'),
}

/**
 * @summary Queries the whitelists of IP addresses that are allowed to access an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the whitelists of IP addresses that are allowed to access an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceIPArrayListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceIPArrayListResponse
 */
async function describeDBInstanceIPArrayListWithOptions(request: DescribeDBInstanceIPArrayListRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceIPArrayListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceIPArrayName)) {
    query['DBInstanceIPArrayName'] = request.DBInstanceIPArrayName;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceIPArrayList',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the whitelists of IP addresses that are allowed to access an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the whitelists of IP addresses that are allowed to access an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstanceIPArrayListRequest
 * @return DescribeDBInstanceIPArrayListResponse
 */
async function describeDBInstanceIPArrayList(request: DescribeDBInstanceIPArrayListRequest): DescribeDBInstanceIPArrayListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceIPArrayListWithOptions(request, runtime);
}

model DescribeDBInstanceIndexUsageRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='test'),
  orderBy?: string(name='OrderBy', description='order by search condition', example='{Field: TableName, Type: Desc}'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='20'),
}

model DescribeDBInstanceIndexUsageResponseBody = {
  items?: [ 
    {
      databaseName?: string(name='DatabaseName', description='The name of the database.', example='adbtest'),
      indexDef?: string(name='IndexDef', description='The definition of the index.', example='CREATE INDEX idx1 ON schema1.tab1_ptr_2010'),
      indexName?: string(name='IndexName', description='The name of the index.', example='idx1'),
      indexScanTimes?: long(name='IndexScanTimes', description='The number of index scans.', example='50000'),
      indexSize?: string(name='IndexSize', description='The size of the index. Unit: bytes.', example='10000'),
      isPartitionTable?: boolean(name='IsPartitionTable', description='Indicates whether the table is a partitioned table. Valid values:

*   **true**: The table is a partitioned table.
*   **false**: The table is not a partitioned table.', example='true'),
      parentTableName?: string(name='ParentTableName', description='The name of the parent table.', example='tab1'),
      schemaName?: string(name='SchemaName', description='The name of the schema.', example='schema1'),
      tableName?: string(name='TableName', description='The name of the table.', example='tab1_ptr_2010'),
      timeLastUpdated?: string(name='TimeLastUpdated', description='The time when the table was last deleted, inserted, or updated.', example='2022-08-08T20:00:00Z'),
    }
  ](name='Items', description='The queried index usage.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeDBInstanceIndexUsageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceIndexUsageResponseBody(name='body'),
}

/**
 * @summary Queries the index usage of an AnalyticDB for PostgreSQL instance.
 *
 * @description Appropriate indexes can accelerate database queries. You can call this operation to query the index usage of an AnalyticDB for PostgreSQL instance.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDBInstanceIndexUsageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceIndexUsageResponse
 */
async function describeDBInstanceIndexUsageWithOptions(request: DescribeDBInstanceIndexUsageRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceIndexUsageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceIndexUsage',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the index usage of an AnalyticDB for PostgreSQL instance.
 *
 * @description Appropriate indexes can accelerate database queries. You can call this operation to query the index usage of an AnalyticDB for PostgreSQL instance.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDBInstanceIndexUsageRequest
 * @return DescribeDBInstanceIndexUsageResponse
 */
async function describeDBInstanceIndexUsage(request: DescribeDBInstanceIndexUsageRequest): DescribeDBInstanceIndexUsageResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceIndexUsageWithOptions(request, runtime);
}

model DescribeDBInstanceNetInfoRequest {
  connectionString?: string(name='ConnectionString', description='The endpoint that is used to connect to the instance.

>  If you do not specify this parameter, the information about all endpoints of the instance is returned.', example='gp-0xin9q82c33xc****-master.gpdb.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxxx'),
}

model DescribeDBInstanceNetInfoResponseBody = {
  DBInstanceNetInfos?: {
    DBInstanceNetInfo?: [ 
    {
      addressType?: string(name='AddressType', description='The type of the endpoint.', example='Intranet'),
      connectionString?: string(name='ConnectionString', description='The endpoint that is used to connect to the instance.', example='gp-xxxxxxx.gpdb.rds.aliyuncs.com'),
      IPAddress?: string(name='IPAddress', description='The IP address.', example='127.0.0.1'),
      IPType?: string(name='IPType', description='The type of the IP address.

*   Valid values for instances in the classic network: Inner and Public.
*   Valid values for instances in a virtual private cloud (VPC): Private and Public.', example='Inner'),
      port?: string(name='Port', description='The port number.', example='3432'),
      VPCId?: string(name='VPCId', description='The VPC ID of the instance.', example='vpc-xxxxxxx'),
      vSwitchId?: string(name='VSwitchId', description='The vSwitch ID. Multiple IDs are separated by commas (,).', example='vsw-xxxxxxxx'),
      vpcInstanceId?: string(name='VpcInstanceId', description='The ID of the instance that is deployed in a VPC.', example='vpc-xxxxxxx'),
    }
  ](name='DBInstanceNetInfo')
  }(name='DBInstanceNetInfos', description='The connection information of the instance.'),
  instanceNetworkType?: string(name='InstanceNetworkType', description='The network type of the instance. Valid values:

*   Classic: classic network.
*   VPC: VPC.', example='Classic'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396F2CAD1'),
}

model DescribeDBInstanceNetInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceNetInfoResponseBody(name='body'),
}

/**
 * @summary Queries the connection information of an instance.
 *
 * @param request DescribeDBInstanceNetInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceNetInfoResponse
 */
async function describeDBInstanceNetInfoWithOptions(request: DescribeDBInstanceNetInfoRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceNetInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.connectionString)) {
    query['ConnectionString'] = request.connectionString;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceNetInfo',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the connection information of an instance.
 *
 * @param request DescribeDBInstanceNetInfoRequest
 * @return DescribeDBInstanceNetInfoResponse
 */
async function describeDBInstanceNetInfo(request: DescribeDBInstanceNetInfoRequest): DescribeDBInstanceNetInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceNetInfoWithOptions(request, runtime);
}

model DescribeDBInstancePerformanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC. The end time must be later than the start time.

This parameter is required.', example='2022-07-09T03:47Z'),
  key?: string(name='Key', description='The performance metric. Separate multiple values with commas (,). For more information, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).

This parameter is required.', example='CpuUsage,MemoryUsage,Gpdb_SpaceUsage,Gpdb_IOPS,Gpdb_session'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.

This parameter is required.', example='2022-07-08T03:47Z'),
}

model DescribeDBInstancePerformanceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end time of the query.', example='2022-07-09T03:47Z'),
  engine?: string(name='Engine', description='The database engine of the instance.', example='gpdb'),
  performanceKeys?: [ string ](name='PerformanceKeys', description='The queried performance metrics.'),
  requestId?: string(name='RequestId', description='The request ID.', example='5E85244A-AB47-46A3-A3AD-5F307DCB407E'),
  startTime?: string(name='StartTime', description='The start time of the query.', example='2022-07-08T03:47Z'),
}

model DescribeDBInstancePerformanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstancePerformanceResponseBody(name='body'),
}

/**
 * @summary Queries the information about performance metrics of an AnalyticDB for PostgreSQL instance within a time range.
 *
 * @param request DescribeDBInstancePerformanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstancePerformanceResponse
 */
async function describeDBInstancePerformanceWithOptions(request: DescribeDBInstancePerformanceRequest, runtime: Util.RuntimeOptions): DescribeDBInstancePerformanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstancePerformance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about performance metrics of an AnalyticDB for PostgreSQL instance within a time range.
 *
 * @param request DescribeDBInstancePerformanceRequest
 * @return DescribeDBInstancePerformanceResponse
 */
async function describeDBInstancePerformance(request: DescribeDBInstancePerformanceRequest): DescribeDBInstancePerformanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstancePerformanceWithOptions(request, runtime);
}

model DescribeDBInstancePlansRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  planCreateDate?: string(name='PlanCreateDate', description='The time that is used to filter plans. If you specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format, the plans that are created before this time are returned. The time must be in UTC. If you do not specify this parameter, all plans are returned.', example='2022-04-17T23:00Z'),
  planDesc?: string(name='PlanDesc', description='The description of the plan.', example='this is a test plan'),
  planId?: string(name='PlanId', description='The plan ID.

> You can call the [DescribeDBInstancePlans](https://help.aliyun.com/document_detail/449398.html) operation to query the information about plans, including plan IDs.', example='1234'),
  planScheduleType?: string(name='PlanScheduleType', description='The execution mode of the plan. Valid values:

*   **Postpone**: The plan is executed later.
*   **Regular**: The plan is executed periodically.', example='Regular'),
  planType?: string(name='PlanType', description='The type of the plan. Valid values:

*   **PauseResume**: pauses and resumes an instance.
*   **Resize**: scales an instance.
*   **ModifySpec**: changes compute node specifications.', example='PauseResume'),
}

model DescribeDBInstancePlansResponseBody = {
  errorMessage?: string(name='ErrorMessage', description='The error message.

This parameter is returned only if the request fails.', example='****'),
  items?: {
    planList?: [ 
    {
      DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
      planConfig?: string(name='PlanConfig', description='The execution information of the plan.', example='{"pause":{"planCronTime":"0 22 * * 5"},"resume":{"planCronTime":"0 23 * * 5"}}'),
      planDesc?: string(name='PlanDesc', description='The description of the plan.', example='this is a test plan'),
      planEndDate?: string(name='PlanEndDate', description='The end time of the plan. The time follows the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time is displayed in UTC.

> 

*   This parameter is returned only for the plans that are periodically executed.

*   If you did not specify the end time when you created the plan, this parameter is not returned.', example='2023-04-17T23:00Z'),
      planId?: string(name='PlanId', description='The plan ID.', example='1234'),
      planName?: string(name='PlanName', description='The name of the plan.', example='test-plan'),
      planScheduleType?: string(name='PlanScheduleType', description='The execution mode of the plan. Valid values:

*   **Postpone**: The plan is executed later.
*   **Regular**: The plan is executed periodically.', example='Regular'),
      planStartDate?: string(name='PlanStartDate', description='The start time of the plan. The time follows the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time is displayed in UTC.

> 

*   This parameter is returned only for the plans that are periodically executed.

*   If you did not specify the start time when you created the plan, the current time is returned.', example='2022-04-17T23:00Z'),
      planStatus?: string(name='PlanStatus', description='The status of the plan. Valid values:

*   **active**
*   **cancel**
*   **deleted**
*   **finished**', example='active'),
      planType?: string(name='PlanType', description='The type of the plan. Valid values:

*   **PauseResume**: pauses and resumes an instance.
*   **Resize**: scales an instance.', example='PauseResume'),
    }
  ](name='PlanList')
  }(name='Items', description='The queried plans.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='34b32a0a-08ef-4a87-b6be-cdd988888888'),
  status?: string(name='Status', description='Indicates whether the request was successful.

If the request was successful, **success** is returned. If the request failed, this parameter is not returned.', example='success'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='1'),
}

model DescribeDBInstancePlansResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstancePlansResponseBody(name='body'),
}

/**
 * @summary Queries the information about plans for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of plans for an AnalyticDB for PostgreSQL instance in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstancePlansRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstancePlansResponse
 */
async function describeDBInstancePlansWithOptions(request: DescribeDBInstancePlansRequest, runtime: Util.RuntimeOptions): DescribeDBInstancePlansResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.planCreateDate)) {
    query['PlanCreateDate'] = request.planCreateDate;
  }
  if (!Util.isUnset(request.planDesc)) {
    query['PlanDesc'] = request.planDesc;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.planScheduleType)) {
    query['PlanScheduleType'] = request.planScheduleType;
  }
  if (!Util.isUnset(request.planType)) {
    query['PlanType'] = request.planType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstancePlans',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about plans for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of plans for an AnalyticDB for PostgreSQL instance in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstancePlansRequest
 * @return DescribeDBInstancePlansResponse
 */
async function describeDBInstancePlans(request: DescribeDBInstancePlansRequest): DescribeDBInstancePlansResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstancePlansWithOptions(request, runtime);
}

model DescribeDBInstanceSSLRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

This parameter is required.', example='gp-bp12ga6v69h86****'),
}

model DescribeDBInstanceSSLResponseBody = {
  certCommonName?: string(name='CertCommonName', description='The name of the SSL certificate.', example='*.gpdbmaster.xxx.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  DBInstanceName?: string(name='DBInstanceName', description='The name of the instance.', example='gp-bp12ga6v69h86****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D5FF8636-37F6-4CE0-8002-F8734C62C686'),
  SSLEnabled?: boolean(name='SSLEnabled', description='Indicates whether SSL encryption is enabled.', example='true'),
  SSLExpiredTime?: string(name='SSLExpiredTime', description='The expiration time of the SSL certificate.', example='2023-08-05T09:05:53Z'),
}

model DescribeDBInstanceSSLResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceSSLResponseBody(name='body'),
}

/**
 * @summary Queries the SSL information about an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceSSLRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceSSLResponse
 */
async function describeDBInstanceSSLWithOptions(request: DescribeDBInstanceSSLRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceSSLResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceSSL',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the SSL information about an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceSSLRequest
 * @return DescribeDBInstanceSSLResponse
 */
async function describeDBInstanceSSL(request: DescribeDBInstanceSSLRequest): DescribeDBInstanceSSLResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceSSLWithOptions(request, runtime);
}

model DescribeDBInstanceSupportMaxPerformanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp***************'),
  ownerId?: long(name='OwnerId'),
}

model DescribeDBInstanceSupportMaxPerformanceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp***************'),
  performances?: {
    performance?: [ 
    {
      bottleneck?: string(name='Bottleneck', description='The performance bottleneck type.', example='ecs or disk'),
      key?: string(name='Key', description='The name of the performance metric.', example='adbpg_status,adbpg_disk_status,adbpg_connection_status,adbgp_segment_disk_usage_percent_max,adbpg_master_disk_usage_percent_max,adbpg_disk_usage_percent'),
      unit?: string(name='Unit', description='The unit of the performance metric.', example='%'),
      value?: string(name='Value', description='The value of the performance metric.', example='90'),
    }
  ](name='Performance')
  }(name='Performances', description='The queried performance metric.'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DescribeDBInstanceSupportMaxPerformanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstanceSupportMaxPerformanceResponseBody(name='body'),
}

/**
 * @summary Queries the maximum performance of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceSupportMaxPerformanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstanceSupportMaxPerformanceResponse
 */
async function describeDBInstanceSupportMaxPerformanceWithOptions(request: DescribeDBInstanceSupportMaxPerformanceRequest, runtime: Util.RuntimeOptions): DescribeDBInstanceSupportMaxPerformanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstanceSupportMaxPerformance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the maximum performance of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBInstanceSupportMaxPerformanceRequest
 * @return DescribeDBInstanceSupportMaxPerformanceResponse
 */
async function describeDBInstanceSupportMaxPerformance(request: DescribeDBInstanceSupportMaxPerformanceRequest): DescribeDBInstanceSupportMaxPerformanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstanceSupportMaxPerformanceWithOptions(request, runtime);
}

model DescribeDBInstancesRequest {
  DBInstanceCategories?: [ string ](name='DBInstanceCategories', description='The edition of the instance. Separate multiple values with commas (,).'),
  DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.', example='gp-bp12ga6v69h86****'),
  DBInstanceIds?: string(name='DBInstanceIds', description='The instance ID. Separate multiple values with commas (,).', example='gp-bp12ga6v69h86****'),
  DBInstanceModes?: [ string ](name='DBInstanceModes', description='The resource type of the instance. Separate multiple values with commas (,).'),
  DBInstanceStatuses?: [ string ](name='DBInstanceStatuses', description='The state of the instance.'),
  instanceDeployTypes?: [ string ](name='InstanceDeployTypes', description='This parameter is no longer used.'),
  instanceNetworkType?: string(name='InstanceNetworkType', description='The network type of the instance. Valid values:

*   **VPC**: virtual private cloud (VPC).
*   **Classic**: classic network.

> If you do not specify this parameter, instances of all network types are returned.', example='VPC'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='50'),
  regionId?: string(name='RegionId', description='The region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-bp67acfmxazb4p****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.', example='test-key'),
      value?: string(name='Value', description='The value of tag N.', example='test-value'),
    }
  ](name='Tag', description='The tags.'),
  vpcId?: string(name='VpcId', description='The VPC ID. You can use this parameter to filter instances that reside in the specified VPC.', example='vpc-t4nqyp3tc5mx7vy6****'),
}

model DescribeDBInstancesShrinkRequest {
  DBInstanceCategoriesShrink?: string(name='DBInstanceCategories', description='The edition of the instance. Separate multiple values with commas (,).'),
  DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.', example='gp-bp12ga6v69h86****'),
  DBInstanceIds?: string(name='DBInstanceIds', description='The instance ID. Separate multiple values with commas (,).', example='gp-bp12ga6v69h86****'),
  DBInstanceModesShrink?: string(name='DBInstanceModes', description='The resource type of the instance. Separate multiple values with commas (,).'),
  DBInstanceStatusesShrink?: string(name='DBInstanceStatuses', description='The state of the instance.'),
  instanceDeployTypesShrink?: string(name='InstanceDeployTypes', description='This parameter is no longer used.'),
  instanceNetworkType?: string(name='InstanceNetworkType', description='The network type of the instance. Valid values:

*   **VPC**: virtual private cloud (VPC).
*   **Classic**: classic network.

> If you do not specify this parameter, instances of all network types are returned.', example='VPC'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='50'),
  regionId?: string(name='RegionId', description='The region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-bp67acfmxazb4p****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.', example='test-key'),
      value?: string(name='Value', description='The value of tag N.', example='test-value'),
    }
  ](name='Tag', description='The tags.'),
  vpcId?: string(name='VpcId', description='The VPC ID. You can use this parameter to filter instances that reside in the specified VPC.', example='vpc-t4nqyp3tc5mx7vy6****'),
}

model DescribeDBInstancesResponseBody = {
  items?: {
    DBInstance?: [ 
    {
      connectionMode?: string(name='ConnectionMode', description='An invalid parameter. It is no longer returned when you call this operation.

You can call the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/86910.html) operation to query the access mode of an instance.', example='null'),
      createTime?: string(name='CreateTime', description='The time when the instance was created. The time is displayed in UTC.', example='2021-10-09T04:54:08Z'),
      DBInstanceCategory?: string(name='DBInstanceCategory', description='The edition of the instance. Valid values:

*   **Basic**: Basic Edition.
*   **HighAvailability**: High-availability Edition.
*   **Finance**: Enterprise Edition.', example='HighAvailability'),
      DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.', example='gp-bp12ga6v69h86****'),
      DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
      DBInstanceMode?: string(name='DBInstanceMode', description='The resource type of the instance. Valid values:

*   **Serverless**: Serverless mode.
*   **StorageElastic**: elastic storage mode.
*   **Classic**: reserved storage mode.', example='StorageElastic'),
      DBInstanceNetType?: string(name='DBInstanceNetType', description='The type of the network interface card (NIC) that is used by the instance. Valid values:

*   **0**: Internet.
*   **1**: internal network.
*   **2**: VPC.', example='2'),
      DBInstanceStatus?: string(name='DBInstanceStatus', description='The status of the instance. For more information, see [Instance statuses](https://help.aliyun.com/document_detail/86944.html).', example='Running'),
      engine?: string(name='Engine', description='The database engine of the instance.', example='gpdb'),
      engineVersion?: string(name='EngineVersion', description='The database engine version of the instance.', example='6.0'),
      expireTime?: string(name='ExpireTime', description='The expiration time of the instance. The time is displayed in UTC.

>  The expiration time of a pay-as-you-go instance is `2999-09-08T16:00:00Z`.', example='2999-09-08T16:00:00Z'),
      instanceDeployType?: string(name='InstanceDeployType', description='The resource type of the instance. Valid values:

*   **cluster**: Serverless mode or elastic storage mode.
*   **replicaSet**: reserved storage mode.', example='cluster'),
      instanceNetworkType?: string(name='InstanceNetworkType', description='The network type of the instance. Valid values:

*   **Classic**: classic network.
*   **VPC**: VPC.', example='VPC'),
      lockMode?: string(name='LockMode', description='The lock mode of the instance. Valid values:

*   **Unlock**: The instance is not locked.
*   **ManualLock**: The instance is manually locked.
*   **LockByExpiration**: The instance is automatically locked due to instance expiration.
*   **LockByRestoration**: The instance is automatically locked due to instance restoration.
*   **LockByDiskQuota**: The instance is automatically locked due to exhausted storage.
*   **LockReadInstanceByDiskQuota**: The instance is a read-only instance and is automatically locked when the disk space is full.', example='Unlock'),
      lockReason?: string(name='LockReason', description='The reason why the instance is locked. Valid values:

*   **0**: The instance is not locked.
*   **1**: The instance is manually locked.
*   **2**: The instance is automatically locked due to instance expiration.
*   **3**: The instance is automatically locked due to instance restoration.
*   **4**: The instance is automatically locked due to exhausted storage.

>  If the instance is in reserved storage mode and is not locked, null is returned.', example='0'),
      masterNodeNum?: int32(name='MasterNodeNum', description='The number of coordinator nodes.', example='1'),
      payType?: string(name='PayType', description='The billing method of the instance. Valid values:

*   **Postpaid**: pay-as-you-go.
*   **Prepaid**: subscription.', example='Postpaid'),
      prodType?: string(name='ProdType', description='product type', example='standard'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-bp67acfmxazb4p****'),
      segNodeNum?: string(name='SegNodeNum', description='The number of compute nodes.', example='4'),
      serverlessMode?: string(name='ServerlessMode', description='The type of the Serverless mode. Valid values:

*   **Manual**: manual scheduling.
*   **Auto**: automatic scheduling.

>  This parameter is returned only for instances in Serverless mode.', example='Manual'),
      storageSize?: string(name='StorageSize', description='The storage capacity of the instance. Unit: GB.', example='50'),
      storageType?: string(name='StorageType', description='The storage type of the instance. Valid values:

*   **cloud_essd**: enhanced SSD (ESSD).
*   **cloud_efficiency**: ultra disk.', example='cloud_essd'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of tag N.', example='test-key'),
          value?: string(name='Value', description='The value of tag N.', example='test-value'),
        }
      ](name='Tag')
      }(name='Tags', description='The tags that are added to the instance.'),
      vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-bp1cpq8mr64paltkb****'),
      vpcId?: string(name='VpcId', description='The VPC ID of the instance.', example='vpc-bp19ame5m1r3oejns****'),
      zoneId?: string(name='ZoneId', description='The zone ID.', example='cn-hangzhou-h'),
    }
  ](name='DBInstance')
  }(name='Items', description='The queried instances.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='53EA07B7-FC2A-521B-AB7C-27**********'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='1'),
}

model DescribeDBInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBInstancesResponseBody(name='body'),
}

/**
 * @summary Queries a list of AnalyticDB for PostgreSQL instances.
 *
 * @description ##
 * You can call this operation to query the instance types, network types, and states of AnalyticDB for PostgreSQL instances within a region.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq DescribeDBInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBInstancesResponse
 */
async function describeDBInstancesWithOptions(tmpReq: DescribeDBInstancesRequest, runtime: Util.RuntimeOptions): DescribeDBInstancesResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeDBInstancesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.DBInstanceCategories)) {
    request.DBInstanceCategoriesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.DBInstanceCategories, 'DBInstanceCategories', 'simple');
  }
  if (!Util.isUnset(tmpReq.DBInstanceModes)) {
    request.DBInstanceModesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.DBInstanceModes, 'DBInstanceModes', 'simple');
  }
  if (!Util.isUnset(tmpReq.DBInstanceStatuses)) {
    request.DBInstanceStatusesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.DBInstanceStatuses, 'DBInstanceStatuses', 'simple');
  }
  if (!Util.isUnset(tmpReq.instanceDeployTypes)) {
    request.instanceDeployTypesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceDeployTypes, 'InstanceDeployTypes', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceCategoriesShrink)) {
    query['DBInstanceCategories'] = request.DBInstanceCategoriesShrink;
  }
  if (!Util.isUnset(request.DBInstanceDescription)) {
    query['DBInstanceDescription'] = request.DBInstanceDescription;
  }
  if (!Util.isUnset(request.DBInstanceIds)) {
    query['DBInstanceIds'] = request.DBInstanceIds;
  }
  if (!Util.isUnset(request.DBInstanceModesShrink)) {
    query['DBInstanceModes'] = request.DBInstanceModesShrink;
  }
  if (!Util.isUnset(request.DBInstanceStatusesShrink)) {
    query['DBInstanceStatuses'] = request.DBInstanceStatusesShrink;
  }
  if (!Util.isUnset(request.instanceDeployTypesShrink)) {
    query['InstanceDeployTypes'] = request.instanceDeployTypesShrink;
  }
  if (!Util.isUnset(request.instanceNetworkType)) {
    query['InstanceNetworkType'] = request.instanceNetworkType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBInstances',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of AnalyticDB for PostgreSQL instances.
 *
 * @description ##
 * You can call this operation to query the instance types, network types, and states of AnalyticDB for PostgreSQL instances within a region.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDBInstancesRequest
 * @return DescribeDBInstancesResponse
 */
async function describeDBInstances(request: DescribeDBInstancesRequest): DescribeDBInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBInstancesWithOptions(request, runtime);
}

model DescribeDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

>  If you specify this parameter, the information about the specified resource group is returned. If you do not specify this parameter, the information about all resource groups is returned.', example='testgroup'),
}

model DescribeDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  resourceGroupItems?: {
    resourceGroupItem?: [ 
    {
      resourceGroupConfig?: string(name='ResourceGroupConfig', description='The configurations of the resource group.

> 

*   CpuRateLimit: the percentage of CPU resources that are available for the resource group. Unit: %.

*   MemoryLimit: the percentage of memory resources that are available for the resource group. Unit: %.

*   MemorySharedQuota: the percentage of memory resources shared among transactions that are submitted to the resource group. Unit: %. Default value: 80.

*   MemorySpillRatio: the memory spill ratio for memory-intensive transactions. When the memory that is used by memory-intensive transactions reaches this value, data is spilled to disks. Unit: %. Default value: 0.

*   Concurrency: the maximum number of concurrent transactions or parallel queries that are allowed for a resource group. Default value: 20.', example='{"CpuRateLimit":"10","MemoryLimit":"12","MemorySharedQuota":"20","MemorySpillRatio":"75","Concurrency":"3"}'),
      resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.', example='testgroup'),
      roleList?: {
        role?: [ string ](name='Role')
      }(name='RoleList', description='The roles.'),
    }
  ](name='ResourceGroupItem')
  }(name='ResourceGroupItems', description='The queried resource group information.'),
}

model DescribeDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Queries the information about resource groups.
 *
 * @param request DescribeDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBResourceGroupResponse
 */
async function describeDBResourceGroupWithOptions(request: DescribeDBResourceGroupRequest, runtime: Util.RuntimeOptions): DescribeDBResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about resource groups.
 *
 * @param request DescribeDBResourceGroupRequest
 * @return DescribeDBResourceGroupResponse
 */
async function describeDBResourceGroup(request: DescribeDBResourceGroupRequest): DescribeDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBResourceGroupWithOptions(request, runtime);
}

model DescribeDBResourceManagementModeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model DescribeDBResourceManagementModeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  resourceManagementMode?: string(name='ResourceManagementMode', description='The resource management mode. Valid values:

*   resourceGroup: resource group management.
*   resourceQueue: resource queue management.', example='resourceGroup'),
}

model DescribeDBResourceManagementModeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBResourceManagementModeResponseBody(name='body'),
}

/**
 * @summary Queries the resource management mode of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBResourceManagementModeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBResourceManagementModeResponse
 */
async function describeDBResourceManagementModeWithOptions(request: DescribeDBResourceManagementModeRequest, runtime: Util.RuntimeOptions): DescribeDBResourceManagementModeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBResourceManagementMode',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the resource management mode of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeDBResourceManagementModeRequest
 * @return DescribeDBResourceManagementModeResponse
 */
async function describeDBResourceManagementMode(request: DescribeDBResourceManagementModeRequest): DescribeDBResourceManagementModeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBResourceManagementModeWithOptions(request, runtime);
}

model DescribeDBVersionInfosRequest {
  DBInstanceMode?: string(name='DBInstanceMode', description='The resource type of the instance. Valid values:

*   **StorageElastic**: elastic storage mode.
*   **Serverless**: Serverless mode.', example='StorageElastic'),
  DBVersion?: string(name='DBVersion', description='The minor version number that does not include the prefix.', example='6.3.10.20'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
}

model DescribeDBVersionInfosResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  versionDetails?: {
    serverless?: any(name='Serverless', description='The queried minor version information about the instance in Serverless mode.', example='"Serverless": [
                {
                    "engineVersion": "6.0",
                    "versionInfos": [
                        {
                            "kernelVersion": "v2.0.0.5",
                            "releaseDate": "2023-05-28T07:48Z",
                            "expirationDate": "2026-05-28T07:48Z"
                        },
                        {
                            "kernelVersion": "v2.0.0.1",
                            "releaseDate": "2023-03-27T12:44Z",
                            "expirationDate": "2026-03-27T12:44Z"
                        },
                        {
                            "kernelVersion": "v1.0.5.1",
                            "releaseDate": "2023-02-22T11:39Z",
                            "expirationDate": "2026-02-22T11:39Z"
                        }
                    ]
                }
]'),
    storageElastic?: any(name='StorageElastic', description='The queried minor version information about the instance in elastic storage mode.', example='"StorageElasic": [
                {
                    "engineVersion": "6.0",
                    "versionInfos": [
                        {
                            "kernelVersion": "v6.3.11.2",
                            "releaseDate": "2023-08-17T09:14Z",
                            "expirationDate": "2026-08-17T09:14Z"
                        }
          },
                {
                    "engineVersion": "7.0",
                    "versionInfos": [
                        {
                            "kernelVersion": "v7.0.2.0",
                            "releaseDate": "2023-08-09T06:47Z",
                            "expirationDate": "2026-08-09T06:47Z"
                        },
                        {
                            "kernelVersion": "v7.0.1.8",
                            "releaseDate": "2023-05-25T06:56Z",
                            "expirationDate": "2026-05-25T06:56Z"
                        }
                    ]
                }
]'),
  }(name='VersionDetails', description='The queried minor versions.'),
}

model DescribeDBVersionInfosResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBVersionInfosResponseBody(name='body'),
}

/**
 * @summary Queries the information about minor versions of AnalyticDB for PostgreSQL instances.
 *
 * @param request DescribeDBVersionInfosRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBVersionInfosResponse
 */
async function describeDBVersionInfosWithOptions(request: DescribeDBVersionInfosRequest, runtime: Util.RuntimeOptions): DescribeDBVersionInfosResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceMode)) {
    query['DBInstanceMode'] = request.DBInstanceMode;
  }
  if (!Util.isUnset(request.DBVersion)) {
    query['DBVersion'] = request.DBVersion;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBVersionInfos',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about minor versions of AnalyticDB for PostgreSQL instances.
 *
 * @param request DescribeDBVersionInfosRequest
 * @return DescribeDBVersionInfosResponse
 */
async function describeDBVersionInfos(request: DescribeDBVersionInfosRequest): DescribeDBVersionInfosResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBVersionInfosWithOptions(request, runtime);
}

model DescribeDataBackupsRequest {
  backupId?: string(name='BackupId', description='The ID of the backup set. If you specify BackupId, the details of the backup set are returned.

> You can call the [DescribeDataBackups](https://help.aliyun.com/document_detail/210093.html) operation to query the information about all backup sets of an instance, including backup set IDs.', example='327329803'),
  backupMode?: string(name='BackupMode', description='The backup mode. Valid values:

*   Automated
*   Manual

If you do not specify this parameter, all backup sets are returned.', example='Automated'),
  backupStatus?: string(name='BackupStatus', description='The state of the backup set. Valid values:

*   Success
*   Failed

If you do not specify this parameter, all backup sets are returned.', example='Success'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  dataType?: string(name='DataType', description='The backup type. Valid values:

*   **DATA**: full backup.
*   **RESTOREPOI**: point-in-time recovery backup.

If you do not specify this parameter, the backup sets of full backup are returned.', example='DATA'),
  endTime?: string(name='EndTime', description='The end of the time range to query. The end time must be later than the start time. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.', example='2011-06-01T16:00Z'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   30
*   50
*   100

Default value: 30.', example='30'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.', example='2011-06-01T15:00Z'),
}

model DescribeDataBackupsResponseBody = {
  items?: [ 
    {
      backupEndTime?: string(name='BackupEndTime', description='The UTC time when the backup ended. The time is in the yyyy-MM-ddTHH:mmZ format. The time is displayed in UTC.', example='2021-12-22T12:01:43Z'),
      backupEndTimeLocal?: string(name='BackupEndTimeLocal', description='The local time when the backup ended. The time is in the yyyy-MM-dd HH:mm:ss format. The time is your local time.', example='2021-12-22 20:00:25'),
      backupMethod?: string(name='BackupMethod', description='The method that is used to generate the backup set. Valid values:

*   **Logical**: logical backup
*   **Physical**: physical backup
*   **Snapshot**: snapshot backup', example='Physical'),
      backupMode?: string(name='BackupMode', description='The backup mode.

Valid values for full backup:

*   Automated: automatic backup
*   Manual: manual backup

Valid values for point-in-time backup:

*   Automated: point-in-time backup after full backup
*   Manual: manual point-in-time backup
*   Period: point-in-time backup that is triggered by a backup policy', example='Automated'),
      backupSetId?: string(name='BackupSetId', description='The ID of the backup set.', example='1111111111'),
      backupSize?: long(name='BackupSize', description='The size of the backup file. Unit: bytes.', example='2167808'),
      backupStartTime?: string(name='BackupStartTime', description='The UTC time when the backup started. The time is in the yyyy-MM-ddTHH:mmZ format. The time is displayed in UTC.', example='2021-12-22T12:00:25Z'),
      backupStartTimeLocal?: string(name='BackupStartTimeLocal', description='The local time when the backup started. The time is in the yyyy-MM-dd HH:mm:ss format. The time is your local time.', example='2011-05-30 03:29:00'),
      backupStatus?: string(name='BackupStatus', description='The status of the backup set. Valid values:

*   Success
*   Failure', example='Success'),
      baksetName?: string(name='BaksetName', description='The name of a point-in-time backup set or the full backup set.', example='adbpgbackup_555*****_20211222200019'),
      consistentTime?: long(name='ConsistentTime', description='*   For full backup, this parameter indicates the point in time at which the data in the data backup file is consistent.
*   For point-in-time backup, this parameter indicates that the returned point in time is a timestamp.', example='1576506856'),
      DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp**************-master'),
      dataType?: string(name='DataType', description='The type of the backup. Valid values:

*   DATA: full backup
*   RESTOREPOI: point-in-time backup', example='DATA'),
    }
  ](name='Items', description='The instance ID.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='3E387971-33A5-5019-AD7F-DC**********'),
  totalBackupSize?: long(name='TotalBackupSize', description='The total backup set size. Unit: Byte.', example='1111111111'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeDataBackupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDataBackupsResponseBody(name='body'),
}

/**
 * @summary Queries a list of backup sets of full backup or point-in-time backup for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query a list of backup sets and backup details only for instances in elastic storage mode.
 *
 * @param request DescribeDataBackupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDataBackupsResponse
 */
async function describeDataBackupsWithOptions(request: DescribeDataBackupsRequest, runtime: Util.RuntimeOptions): DescribeDataBackupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupId)) {
    query['BackupId'] = request.backupId;
  }
  if (!Util.isUnset(request.backupMode)) {
    query['BackupMode'] = request.backupMode;
  }
  if (!Util.isUnset(request.backupStatus)) {
    query['BackupStatus'] = request.backupStatus;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataType)) {
    query['DataType'] = request.dataType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataBackups',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of backup sets of full backup or point-in-time backup for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query a list of backup sets and backup details only for instances in elastic storage mode.
 *
 * @param request DescribeDataBackupsRequest
 * @return DescribeDataBackupsResponse
 */
async function describeDataBackups(request: DescribeDataBackupsRequest): DescribeDataBackupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDataBackupsWithOptions(request, runtime);
}

model DescribeDataReDistributeInfoRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model DescribeDataReDistributeInfoResponseBody = {
  dataReDistributeInfo?: {
    message?: string(name='Message', description='The execution information. If an error occurs, the error message is returned.', example='redistributing'),
    progress?: long(name='Progress', description='The progress of data redistribution. Unit: %.', example='33'),
    remainTime?: string(name='RemainTime', description='The estimated remaining time for data redistribution.', example='00:01:28'),
    startTime?: string(name='StartTime', description='This parameter is not supported.', example='null'),
    status?: string(name='Status', description='The status of data redistribution.', example='RUNNING'),
    type?: string(name='Type', description='The execution type. The value **immediate** is returned, indicating immediate execution.', example='immediate'),
  }(name='DataReDistributeInfo', description='The data redistribution information.'),
  requestId?: string(name='RequestId', description='The request ID.', example='04836A02-ADC9-1AA7-AC36-DE5E048BF505'),
}

model DescribeDataReDistributeInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDataReDistributeInfoResponseBody(name='body'),
}

/**
 * @summary Queries the data redistribution information about an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 *
 * @param request DescribeDataReDistributeInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDataReDistributeInfoResponse
 */
async function describeDataReDistributeInfoWithOptions(request: DescribeDataReDistributeInfoRequest, runtime: Util.RuntimeOptions): DescribeDataReDistributeInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataReDistributeInfo',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the data redistribution information about an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 *
 * @param request DescribeDataReDistributeInfoRequest
 * @return DescribeDataReDistributeInfoResponse
 */
async function describeDataReDistributeInfo(request: DescribeDataReDistributeInfoRequest): DescribeDataReDistributeInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDataReDistributeInfoWithOptions(request, runtime);
}

model DescribeDataShareInstancesRequest {
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: 30.', example='30'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  searchValue?: string(name='SearchValue', description='The keyword used to filter instances, which can be an instance ID or instance description.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs and instance descriptions.', example='gp-bp***************'),
}

model DescribeDataShareInstancesResponseBody = {
  items?: {
    DBInstance?: [ 
    {
      DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp***************'),
      DBInstanceMode?: string(name='DBInstanceMode', description='The resource type of the instance. Valid values:

*   **Serverless**: Serverless mode
*   **StorageElasic**: elastic storage mode
*   **Classic**: reserved storage mode', example='Serverless'),
      dataShareStatus?: string(name='DataShareStatus', description='The state of data sharing. Valid values:

*   **opening**: Data sharing is being enabled.
*   **opened**: Data sharing is enabled.
*   **closing**: Data sharing is being disabled.
*   **closed**: Data sharing is disabled.', example='opened'),
      description?: string(name='Description', description='The description of the instance.', example='gp-bp***************'),
      regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
      zoneId?: string(name='ZoneId', description='The zone ID of the instance.', example='cn-hangzhou-j'),
    }
  ](name='DBInstance')
  }(name='Items', description='The state of data sharing. Valid values:

*   **opening**
*   **opened**
*   **closing**
*   **closed**'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D5**********'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='1'),
}

model DescribeDataShareInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDataShareInstancesResponseBody(name='body'),
}

/**
 * @summary Queries the state of data sharing for AnalyticDB for PostgreSQL instances.
 *
 * @description Data sharing is supported only for instances in Serverless mode.
 *
 * @param request DescribeDataShareInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDataShareInstancesResponse
 */
async function describeDataShareInstancesWithOptions(request: DescribeDataShareInstancesRequest, runtime: Util.RuntimeOptions): DescribeDataShareInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.searchValue)) {
    query['SearchValue'] = request.searchValue;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataShareInstances',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the state of data sharing for AnalyticDB for PostgreSQL instances.
 *
 * @description Data sharing is supported only for instances in Serverless mode.
 *
 * @param request DescribeDataShareInstancesRequest
 * @return DescribeDataShareInstancesResponse
 */
async function describeDataShareInstances(request: DescribeDataShareInstancesRequest): DescribeDataShareInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDataShareInstancesWithOptions(request, runtime);
}

model DescribeDataSharePerformanceRequest {
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-08-03T15:10Z'),
  key?: string(name='Key', description='The name of the performance metric. Separate multiple values with commas (,). Valid values:

*   **adbpg_datashare_topic_count**: the number of shared topics.
*   **adbpg_datashare_data_size_mb**: the amount of data shared.

This parameter is required.', example='adbpg_datashare_topic_count'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-08-03T15:00Z'),
}

model DescribeDataSharePerformanceResponseBody = {
  DBClusterId?: string(name='DBClusterId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end time of the query.', example='2022-08-03T15:10Z'),
  performanceKeys?: [ 
    {
      name?: string(name='Name', description='The name of the performance metric.', example='adbpg_datashare_topic_count'),
      series?: [ 
        {
          name?: string(name='Name', description='The name of the performance metric.', example='adbpg_datashare_topic_count'),
          values?: [ 
            {
              point?: [ string ](name='Point', description='The value of the performance metric at a point in time.'),
            }
          ](name='Values', description='One or more values of the performance metric.'),
        }
      ](name='Series', description='Details of the performance metric.'),
      unit?: string(name='Unit', description='The unit of the performance metric.', example='int'),
    }
  ](name='PerformanceKeys', description='Details of data sharing performance metrics.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='BBE00C04-A3E8-4114-881D-0480A72CB92E'),
  startTime?: string(name='StartTime', description='The start time of the query.', example='2022-08-03T15:00Z'),
}

model DescribeDataSharePerformanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDataSharePerformanceResponseBody(name='body'),
}

/**
 * @summary Queries the information about data sharing performance metrics.
 *
 * @description You can call this operation to query the details of data sharing performance metrics for an AnalyticDB for PostgreSQL instance in Serverless mode, such as the number of shared topics and the amount of data shared.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDataSharePerformanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDataSharePerformanceResponse
 */
async function describeDataSharePerformanceWithOptions(request: DescribeDataSharePerformanceRequest, runtime: Util.RuntimeOptions): DescribeDataSharePerformanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataSharePerformance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about data sharing performance metrics.
 *
 * @description You can call this operation to query the details of data sharing performance metrics for an AnalyticDB for PostgreSQL instance in Serverless mode, such as the number of shared topics and the amount of data shared.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDataSharePerformanceRequest
 * @return DescribeDataSharePerformanceResponse
 */
async function describeDataSharePerformance(request: DescribeDataSharePerformanceRequest): DescribeDataSharePerformanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDataSharePerformanceWithOptions(request, runtime);
}

model DescribeDiagnosisDimensionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
}

model DescribeDiagnosisDimensionsResponseBody = {
  databases?: [ string ](name='Databases', description='The names of the databases.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9ADCAACA-E0E8-5319-AE3B-E260E957BDF9'),
  userNames?: [ string ](name='UserNames', description='The names of the database accounts.'),
}

model DescribeDiagnosisDimensionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDiagnosisDimensionsResponseBody(name='body'),
}

/**
 * @summary Queries all databases and database accounts for an AnalyticDB for PostgreSQL instance.
 *
 * @description To facilitate management, you can call this operation to query all databases and database accounts on an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisDimensionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDiagnosisDimensionsResponse
 */
async function describeDiagnosisDimensionsWithOptions(request: DescribeDiagnosisDimensionsRequest, runtime: Util.RuntimeOptions): DescribeDiagnosisDimensionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDiagnosisDimensions',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all databases and database accounts for an AnalyticDB for PostgreSQL instance.
 *
 * @description To facilitate management, you can call this operation to query all databases and database accounts on an AnalyticDB for PostgreSQL instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisDimensionsRequest
 * @return DescribeDiagnosisDimensionsResponse
 */
async function describeDiagnosisDimensions(request: DescribeDiagnosisDimensionsRequest): DescribeDiagnosisDimensionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDiagnosisDimensionsWithOptions(request, runtime);
}

model DescribeDiagnosisMonitorPerformanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC. The end time must be later than the start time.', example='2022-05-07T07:59Z'),
  queryCondition?: string(name='QueryCondition', description='The filter condition on queries. Specify the value in the JSON format. Valid values:

*   `{"Type":"maxCost", "Value":"100"}`: filters the top 100 queries that are the most time-consuming.

*   `{"Type":"status","Value":"finished"}`: filters completed queries.

*   `{"Type":"status","Value":"running"}`: filters running queries.

*   `{"Type":"cost","Min":"30","Max":"50"}`: filters the queries that consume 30 milliseconds or more and less than 50 milliseconds. You can customize a filter condition by setting **Min** and **Max**.

    *   If only **Min** is specified, the queries that consume a period of time that is greater than or equal to the Min value are filtered.
    *   If only **Max** is specified, the queries that consume a period of time that is less than the Max value are filtered.
    *   If both **Min** and **Max** are specified, the queries that consume a period of time that is greater than or equal to the **Min** value and less than the **Max** value are filtered.', example='{"Type":"maxCost", "Value":"100"}'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-05-07T06:59Z'),
  user?: string(name='User', description='The name of the database account.', example='adbpguser'),
}

model DescribeDiagnosisMonitorPerformanceResponseBody = {
  performances?: [ 
    {
      cost?: int32(name='Cost', description='The execution duration of the query. Unit: milliseconds.', example='1'),
      database?: string(name='Database', description='The name of the database.', example='adbtest'),
      queryID?: string(name='QueryID', description='The ID of the query. It is a unique identifier of the query.', example='2022042612465401000000012903151998970'),
      startTime?: long(name='StartTime', description='The start time of the query. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.', example='1651877940000'),
      status?: string(name='Status', description='The execution state of the query. Valid values:

*   **running**: The query is being executed.
*   **finished**: The query is complete.', example='finished'),
      user?: string(name='User', description='The name of the database account.', example='adbpguser'),
    }
  ](name='Performances', description='Details of query execution.'),
  performancesThreshold?: int32(name='PerformancesThreshold', description='The threshold for the number of queries.', example='10000'),
  performancesTruncated?: boolean(name='PerformancesTruncated', description='Indicates whether the queries are truncated when the number of queries exceeds the threshold. Valid values:

*   **true**: The queries are truncated.
*   **false**: The queries are not truncated.', example='false'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeDiagnosisMonitorPerformanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDiagnosisMonitorPerformanceResponseBody(name='body'),
}

/**
 * @summary Queries the details of query execution on an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of query execution on an AnalyticDB for PostgreSQL instance in elastic storage mode within a specified time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisMonitorPerformanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDiagnosisMonitorPerformanceResponse
 */
async function describeDiagnosisMonitorPerformanceWithOptions(request: DescribeDiagnosisMonitorPerformanceRequest, runtime: Util.RuntimeOptions): DescribeDiagnosisMonitorPerformanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.queryCondition)) {
    query['QueryCondition'] = request.queryCondition;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDiagnosisMonitorPerformance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of query execution on an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of query execution on an AnalyticDB for PostgreSQL instance in elastic storage mode within a specified time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisMonitorPerformanceRequest
 * @return DescribeDiagnosisMonitorPerformanceResponse
 */
async function describeDiagnosisMonitorPerformance(request: DescribeDiagnosisMonitorPerformanceRequest): DescribeDiagnosisMonitorPerformanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDiagnosisMonitorPerformanceWithOptions(request, runtime);
}

model DescribeDiagnosisRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC. The end time must be later than the start time.', example='2022-05-07T07:59Z'),
  keyword?: string(name='Keyword', description='The keyword of the SQL statement.', example='SELECT'),
  order?: string(name='Order', description='The order of fields in the console. You do not need to specify this parameter.', example='null'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  queryCondition?: string(name='QueryCondition', description='The filter condition on queries. Specify the value in the JSON format. Valid values:

*   `{"Type":"maxCost", "Value":"100"}`: filters the top 100 queries that are the most time-consuming.

*   `{"Type":"status","Value":"finished"}`: filters completed queries.

*   `{"Type":"status","Value":"running"}`: filters running queries.

*   `{"Type":"cost","Min":"30","Max":"50"}`: filters the queries that consume a period of 30 milliseconds to less than 50 milliseconds. You can customize a filter condition by setting **Min** and **Max**.

    *   If only **Min** is specified, the queries that consume a period of time that is greater than the Min value are filtered.
    *   If only **Max** is specified, the queries that consume a period of time that is less than the Max value are filtered.
    *   If both **Min** and **Max** are specified, the queries that consume a period of time that is greater than or equal to the **Min** value and less than or equal to the **Max** value are filtered.', example='{ "Type":"maxCost", "Value":"100" }'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-05-07T06:59Z'),
  user?: string(name='User', description='The name of the database account.', example='adbpguser'),
}

model DescribeDiagnosisRecordsResponseBody = {
  items?: [ 
    {
      database?: string(name='Database', description='The name of the database.', example='adbtest'),
      duration?: int32(name='Duration', description='The execution duration of the query. Unit: seconds.', example='1'),
      queryID?: string(name='QueryID', description='The ID of the query. It is a unique identifier of the query.', example='2022042612465401000000012903151998970'),
      SQLStmt?: string(name='SQLStmt', description='The SQL statement.', example='SELECT * FROM t1,t2 WHERE t1.id=t2.id;'),
      SQLTruncated?: boolean(name='SQLTruncated', description='Indicates whether the SQL statement needs to be truncated. Valid values:

*   **true**: The SQL statement needs to be truncated.
*   **false**: The SQL statement does not need to be truncated.', example='false'),
      SQLTruncatedThreshold?: int32(name='SQLTruncatedThreshold', description='The threshold used to determine whether an SQL statement must be truncated. The value is the number of characters.', example='5120'),
      sessionID?: string(name='SessionID', description='The ID of the session that contains the query.', example='50'),
      startTime?: long(name='StartTime', description='The start time of the query. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.', example='1651877940000'),
      status?: string(name='Status', description='The execution state of the query. Valid values:

*   **running**: The query is being executed.
*   **finished**: The query is complete.', example='finished'),
      user?: string(name='User', description='The name of the database account.', example='adbpguser'),
    }
  ](name='Items', description='The threshold that determines whether the SQL statement must be truncated. The value is the number of characters.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='100'),
}

model DescribeDiagnosisRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDiagnosisRecordsResponseBody(name='body'),
}

/**
 * @summary Queries the information about SQL queries for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of SQL queries on an AnalyticDB for PostgreSQL instance within a specified time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDiagnosisRecordsResponse
 */
async function describeDiagnosisRecordsWithOptions(request: DescribeDiagnosisRecordsRequest, runtime: Util.RuntimeOptions): DescribeDiagnosisRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.keyword)) {
    query['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryCondition)) {
    query['QueryCondition'] = request.queryCondition;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDiagnosisRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about SQL queries for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of SQL queries on an AnalyticDB for PostgreSQL instance within a specified time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeDiagnosisRecordsRequest
 * @return DescribeDiagnosisRecordsResponse
 */
async function describeDiagnosisRecords(request: DescribeDiagnosisRecordsRequest): DescribeDiagnosisRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDiagnosisRecordsWithOptions(request, runtime);
}

model DescribeDiagnosisSQLInfoRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  queryID?: string(name='QueryID', description='The query ID. It is a unique identifier of the query.

> You can call the [DescribeDiagnosisRecords](https://help.aliyun.com/document_detail/450511.html) operation to obtain query IDs.

This parameter is required.', example='71403480878****'),
}

model DescribeDiagnosisSQLInfoResponseBody = {
  database?: string(name='Database', description='The name of the database.', example='adbtest'),
  duration?: int32(name='Duration', description='The execution duration of the query. Unit: seconds.', example='16'),
  maxOutputRows?: string(name='MaxOutputRows', description='The maximum number of output rows.', example='10'),
  queryID?: string(name='QueryID', description='The query ID.', example='71403480878****'),
  queryPlan?: string(name='QueryPlan', description='The information about the operator.', example='{\\\\"children\\\\":********\\\\"startTime\\\\":1660719602199}'),
  requestId?: string(name='RequestId', description='The request ID.', example='425AAA6A-63E0-1929-A1CE-3D9036CBC463'),
  SQLStmt?: string(name='SQLStmt', description='The SQL statement.', example='select n_live_tup, n_live_tup + n_dead_tup, pg_relation_size(table_name), last_vacuum from pg_stat_user_tables where relid = table_name::regclass'),
  sessionID?: string(name='SessionID', description='The ID of the session that contains the query.', example='658****'),
  sortedMetrics?: string(name='SortedMetrics', description='The sequence of metrics.', example='{\\\\"costSort\\\\":******:\\\\"Seq Scan-9\\\\",\\\\"value\\\\":0.0}]}'),
  startTime?: long(name='StartTime', description='The start time of the query. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1660719602199'),
  status?: string(name='Status', description='The execution state of the query. Valid values:

*   **running**
*   **finished**', example='finished'),
  textPlan?: string(name='TextPlan', description='The information about the execution plan.', example='******'),
  user?: string(name='User', description='The username.', example='adbpguser'),
}

model DescribeDiagnosisSQLInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDiagnosisSQLInfoResponseBody(name='body'),
}

/**
 * @summary Queries the information about a query for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the information about a query for an AnalyticDB for PostgreSQL instance, including the SQL statement, execution plan text, and execution plan tree.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDiagnosisSQLInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDiagnosisSQLInfoResponse
 */
async function describeDiagnosisSQLInfoWithOptions(request: DescribeDiagnosisSQLInfoRequest, runtime: Util.RuntimeOptions): DescribeDiagnosisSQLInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.queryID)) {
    query['QueryID'] = request.queryID;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDiagnosisSQLInfo',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a query for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the information about a query for an AnalyticDB for PostgreSQL instance, including the SQL statement, execution plan text, and execution plan tree.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDiagnosisSQLInfoRequest
 * @return DescribeDiagnosisSQLInfoResponse
 */
async function describeDiagnosisSQLInfo(request: DescribeDiagnosisSQLInfoRequest): DescribeDiagnosisSQLInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDiagnosisSQLInfoWithOptions(request, runtime);
}

model DescribeDocumentRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the already created document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='Document name.

> You can view the list of documents using the [ListDocuments](https://help.aliyun.com/document_detail/2618453.html) API.

This parameter is required.', example='music.txt'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create it via the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list through the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified by the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeDocumentResponseBody = {
  chunkFileUrl?: string(name='ChunkFileUrl', description='URL of the split file, valid for 2 hours. The file format is JSONL, with each line formatted as `{"page_content":"*****", "metadata": {"**":"***","**":"***"}`.', example='http://oss.xxx/music_chunk.jsonl'),
  docsCount?: int32(name='DocsCount', description='Number of documents after splitting.', example='100'),
  documentLoader?: string(name='DocumentLoader', description='Name of the document loader.', example='RapidOCRPDFLoader'),
  fileExt?: string(name='FileExt', description='File extension.', example='txt'),
  fileMd5?: string(name='FileMd5', description='MD5 value of the file.', example='b8078c9591413550f8963e37e24abcea'),
  fileMtime?: string(name='FileMtime', description='The last modified time of the document.', example='2023-11-01 10:01:01.123456'),
  fileName?: string(name='FileName', description='File name.', example='music.txt'),
  fileSize?: long(name='FileSize', description='File size, in bytes.', example='10000'),
  fileUrl?: string(name='FileUrl', description='Download URL of the document, valid for 2 hours.', example='http://oss.xxx/music.txt'),
  fileVersion?: int32(name='FileVersion', description='Document version. This value increments by 1 each time the same document is updated and uploaded.', example='1'),
  message?: string(name='Message', description='Detailed information returned by the API.', example='success'),
  plainChunkFileUrl?: string(name='PlainChunkFileUrl', description='Download URL for the plain text (without metadata) after splitting, each line is a chunk, valid for 2 hours.', example='http://oss.xxx/music_plain_chunk.txt'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  source?: string(name='Source', description='Source of the document.', example='OSS'),
  status?: string(name='Status', description='API execution status, with values as follows:
- **success**: Execution succeeded.
- **fail**: Execution failed.', example='success'),
  textSplitter?: string(name='TextSplitter', description='Name of the text splitter.', example='ChineseRecursiveTextSplitter'),
}

model DescribeDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDocumentResponseBody(name='body'),
}

/**
 * @summary Get Document Details
 *
 * @param request DescribeDocumentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDocumentResponse
 */
async function describeDocumentWithOptions(request: DescribeDocumentRequest, runtime: Util.RuntimeOptions): DescribeDocumentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDocument',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get Document Details
 *
 * @param request DescribeDocumentRequest
 * @return DescribeDocumentResponse
 */
async function describeDocument(request: DescribeDocumentRequest): DescribeDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDocumentWithOptions(request, runtime);
}

model DescribeDownloadRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  downloadTaskType?: string(name='DownloadTaskType'),
}

model DescribeDownloadRecordsResponseBody = {
  records?: [ 
    {
      downloadId?: long(name='DownloadId', description='The ID of the download record.', example='1150'),
      downloadUrl?: string(name='DownloadUrl', description='The URL that can be used to download the file.', example='https://perth-download-task.oss-cn-beijing.aliyuncs.com/*****'),
      exceptionMsg?: string(name='ExceptionMsg', description='The error message returned.', example='Error message'),
      fileName?: string(name='FileName', description='The name of the file.', example='20220509113448-20220509173448.csv'),
      status?: string(name='Status', description='The state of the upload task. After you call the DownloadDiagnosisRecords operation, query diagnostic information is first uploaded to Object Storage Service (OSS). After the upload task is complete, the query diagnostic information can be downloaded. Valid values:

*   **running**: uploading
*   **finished**: uploaded
*   **failed**: failed', example='finished'),
    }
  ](name='Records', description='The URL that is used to download the file.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeDownloadRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDownloadRecordsResponseBody(name='body'),
}

/**
 * @summary Queries the download records of query diagnostic information for an AnalyticDB for PostgreSQL instance.
 *
 * @description You must call the [DownloadDiagnosisRecords](https://help.aliyun.com/document_detail/447700.html) operation to download the query diagnostic information before you can call this operation to query the download records and download URLs.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDownloadRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDownloadRecordsResponse
 */
async function describeDownloadRecordsWithOptions(request: DescribeDownloadRecordsRequest, runtime: Util.RuntimeOptions): DescribeDownloadRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.downloadTaskType)) {
    query['DownloadTaskType'] = request.downloadTaskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDownloadRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the download records of query diagnostic information for an AnalyticDB for PostgreSQL instance.
 *
 * @description You must call the [DownloadDiagnosisRecords](https://help.aliyun.com/document_detail/447700.html) operation to download the query diagnostic information before you can call this operation to query the download records and download URLs.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For information about how to view and update the minor version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 *
 * @param request DescribeDownloadRecordsRequest
 * @return DescribeDownloadRecordsResponse
 */
async function describeDownloadRecords(request: DescribeDownloadRecordsRequest): DescribeDownloadRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDownloadRecordsWithOptions(request, runtime);
}

model DescribeDownloadSQLLogsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-bp12ga6v69h86****'),
}

model DescribeDownloadSQLLogsResponseBody = {
  records?: [ 
    {
      downloadId?: long(name='DownloadId', description='Download record ID.', example='1150'),
      downloadUrl?: string(name='DownloadUrl', description='Download link.', example='https://perth-download-task.oss-cn-beijing.aliyuncs.com/*****'),
      exceptionMsg?: string(name='ExceptionMsg', description='Error message.', example='Error message'),
      fileName?: string(name='FileName', description='File name.', example='20220509113448-20220509173448.csv'),
      status?: string(name='Status', description='Task status, with possible values being:
- **running**: Downloading.
- **finished**: Completed.
- **failed**: Download failed.', example='finished'),
    }
  ](name='Records', description='List of download records.'),
  requestId?: string(name='RequestId', description='Request ID.', example='FDE9942A-D919-527B-B559-5D0F6F20CCEC'),
}

model DescribeDownloadSQLLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDownloadSQLLogsResponseBody(name='body'),
}

/**
 * @summary Get download records
 *
 * @param request DescribeDownloadSQLLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDownloadSQLLogsResponse
 */
async function describeDownloadSQLLogsWithOptions(request: DescribeDownloadSQLLogsRequest, runtime: Util.RuntimeOptions): DescribeDownloadSQLLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDownloadSQLLogs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get download records
 *
 * @param request DescribeDownloadSQLLogsRequest
 * @return DescribeDownloadSQLLogsResponse
 */
async function describeDownloadSQLLogs(request: DescribeDownloadSQLLogsRequest): DescribeDownloadSQLLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDownloadSQLLogsWithOptions(request, runtime);
}

model DescribeExternalDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
  serviceId?: string(name='ServiceId', description='The service ID.

This parameter is required.', example='1'),
}

model DescribeExternalDataServiceResponseBody = {
  createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
  modifyTime?: string(name='ModifyTime', description='The time when the service was last modified.', example='2019-09-08T17:00:00Z'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceDescription?: string(name='ServiceDescription', description='The description of the service.', example='test-adbpgss'),
  serviceId?: string(name='ServiceId', description='The service ID.', example='1'),
  serviceName?: string(name='ServiceName', description='The name of the service.', example='test-adbpgss'),
  serviceSpec?: string(name='ServiceSpec', description='The specifications of the service. Unit: compute units (CUs).', example='2'),
  status?: string(name='Status', description='The status of the operation.', example='Running'),
}

model DescribeExternalDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExternalDataServiceResponseBody(name='body'),
}

/**
 * @summary Queries the information about an external data service.
 *
 * @param request DescribeExternalDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExternalDataServiceResponse
 */
async function describeExternalDataServiceWithOptions(request: DescribeExternalDataServiceRequest, runtime: Util.RuntimeOptions): DescribeExternalDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeExternalDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about an external data service.
 *
 * @param request DescribeExternalDataServiceRequest
 * @return DescribeExternalDataServiceResponse
 */
async function describeExternalDataService(request: DescribeExternalDataServiceRequest): DescribeExternalDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeExternalDataServiceWithOptions(request, runtime);
}

model DescribeHadoopClustersInSameNetRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-beijing'),
}

model DescribeHadoopClustersInSameNetResponseBody = {
  clusters?: [ string ](name='Clusters'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeHadoopClustersInSameNetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHadoopClustersInSameNetResponseBody(name='body'),
}

/**
 * @summary Queries E-MapReduce (EMR) Hadoop clusters in a specific virtual private cloud (VPC).
 *
 * @param request DescribeHadoopClustersInSameNetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHadoopClustersInSameNetResponse
 */
async function describeHadoopClustersInSameNetWithOptions(request: DescribeHadoopClustersInSameNetRequest, runtime: Util.RuntimeOptions): DescribeHadoopClustersInSameNetResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHadoopClustersInSameNet',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries E-MapReduce (EMR) Hadoop clusters in a specific virtual private cloud (VPC).
 *
 * @param request DescribeHadoopClustersInSameNetRequest
 * @return DescribeHadoopClustersInSameNetResponse
 */
async function describeHadoopClustersInSameNet(request: DescribeHadoopClustersInSameNetRequest): DescribeHadoopClustersInSameNetResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHadoopClustersInSameNetWithOptions(request, runtime);
}

model DescribeHadoopConfigsRequest {
  configName?: string(name='ConfigName', description='The name of the configuration file. Valid values:

*   hdfs-site
*   core-site
*   yarn-site
*   mapred-site
*   hive-site

This parameter is required.', example='hdfs-site'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  emrInstanceId?: string(name='EmrInstanceId', description='The E-MapReduce (EMR) Hadoop cluster ID.

This parameter is required.', example='c-xxx'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model DescribeHadoopConfigsResponseBody = {
  configName?: string(name='ConfigName', description='The name of the configuration file. Valid values:

*   hdfs-site
*   core-site
*   yarn-site
*   mapred-site
*   hive-site', example='hdfs-site'),
  configValue?: string(name='ConfigValue', description='The configuration value.', example='<?xml version="1.0"?>
<configuration>
    <property>'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeHadoopConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHadoopConfigsResponseBody(name='body'),
}

/**
 * @summary Queries the configuration information about a Hadoop cluster.
 *
 * @param request DescribeHadoopConfigsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHadoopConfigsResponse
 */
async function describeHadoopConfigsWithOptions(request: DescribeHadoopConfigsRequest, runtime: Util.RuntimeOptions): DescribeHadoopConfigsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.configName)) {
    query['ConfigName'] = request.configName;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.emrInstanceId)) {
    query['EmrInstanceId'] = request.emrInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHadoopConfigs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the configuration information about a Hadoop cluster.
 *
 * @param request DescribeHadoopConfigsRequest
 * @return DescribeHadoopConfigsResponse
 */
async function describeHadoopConfigs(request: DescribeHadoopConfigsRequest): DescribeHadoopConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHadoopConfigsWithOptions(request, runtime);
}

model DescribeHadoopDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxx'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.', example='123'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/2361846.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model DescribeHadoopDataSourceResponseBody = {
  createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
  dataSourceDescription?: string(name='DataSourceDescription', description='The description of the service. The description can be up to 256 characters in length.', example='pxf for hdfs data source'),
  dataSourceDir?: string(name='DataSourceDir', description='The service directory in which Hadoop-related configuration files are stored.', example='HadoopDir'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.', example='123'),
  dataSourceName?: string(name='DataSourceName', description='The name of the service.', example='hdfs_pxf'),
  dataSourceStatus?: string(name='DataSourceStatus', description='The status of the service. Valid values:

*   Init
*   Running
*   Exception', example='Running'),
  dataSourceType?: string(name='DataSourceType', description='The type of the data source.', example='hive'),
  emrInstanceId?: string(name='EmrInstanceId', description='The E-MapReduce (EMR) Hadoop cluster ID.', example='c-1234567'),
  externalDataServiceId?: string(name='ExternalDataServiceId', description='The ID of the external data service.', example='2988'),
  HDFSConf?: string(name='HDFSConf', description='The content of the Hadoop hdfs-site.xml file.', example='xxxxxx'),
  hadoopCoreConf?: string(name='HadoopCoreConf', description='The content of the Hadoop core-site.xml file.', example='xxxxxx'),
  hadoopCreateType?: string(name='HadoopCreateType', description='The type of the external service. Valid values:

*   emr
*   selfCreate', example='HDFS'),
  hadoopHostsAddress?: string(name='HadoopHostsAddress', description='The IP address and hostname of the Hadoop cluster (data source) in the /etc/hosts file.', example='127.0.0.1 localhost'),
  hiveConf?: string(name='HiveConf', description='The content of the Hadoop hive-site.xml file.', example='xxxxxx'),
  mapReduceConf?: string(name='MapReduceConf', description='The content of the Hadoop mapred-site.xml file.', example='xxxxxx'),
  modifyTime?: string(name='ModifyTime', description='The time when the data source was last modified.', example='2024-08-23T02:11:47Z'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  statusMessage?: string(name='StatusMessage', description='The information about the service status. For example, if the service is in the exception state, the cause of the exception is displayed. If the service is in the running state, this parameter is left empty.', example='""'),
  yarnConf?: string(name='YarnConf', description='The content of the Hadoop yarn-site.xml file.', example='xxxxxx'),
}

model DescribeHadoopDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHadoopDataSourceResponseBody(name='body'),
}

/**
 * @summary Obtains the configurations of a Hadoop data source.
 *
 * @param request DescribeHadoopDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHadoopDataSourceResponse
 */
async function describeHadoopDataSourceWithOptions(request: DescribeHadoopDataSourceRequest, runtime: Util.RuntimeOptions): DescribeHadoopDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHadoopDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the configurations of a Hadoop data source.
 *
 * @param request DescribeHadoopDataSourceRequest
 * @return DescribeHadoopDataSourceResponse
 */
async function describeHadoopDataSource(request: DescribeHadoopDataSourceRequest): DescribeHadoopDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHadoopDataSourceWithOptions(request, runtime);
}

model DescribeHealthStatusRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  key?: string(name='Key', description='The performance metric that you want to query. Separate multiple values with commas (,). For more information, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).

This parameter is required.', example='node_master_status,node_master_connection_status,node_segment_connection_status,node_segment_disk_status'),
}

model DescribeHealthStatusResponseBody = {
  DBClusterId?: string(name='DBClusterId', description='The ID of instance.', example='gp-bp12ga6v69h86****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D97B4191-104D-10CE-8BC5-53**********'),
  status?: {
    adbgpSegmentDiskUsagePercentMax?: {
      status?: string(name='Status', description='The status corresponding to the maximum storage usage among all compute nodes. Valid values:

*   **critical**: The compute node storage usage is greater than or equal to 90%. In this case, the instance is locked.
*   **warning**: The compute node storage usage is greater than or equal to 80% and less than 90%.
*   **healthy**: The compute node storage usage is less than 80%.', example='healthy'),
      value?: float(name='Value', description='The metric value of maximum compute node storage usage.

Unit: %.', example='1.52'),
    }(name='adbgp_segment_disk_usage_percent_max', description='The information of maximum compute node storage usage.

>  This parameter value is returned only for instances in elastic storage mode.'),
    adbpgConnectionStatus?: {
      status?: string(name='Status', description='The connection health status of the instance. Valid values:

*   **critical**: The instance connection usage is greater than 95%. In this case, this metric is marked in red in the console.
*   **warning**: The instance connection usage is greater than 90% and less than or equal to 95%. In this case, this metric is marked in yellow in the console.
*   **healthy**: The instance connection usage is less than or equal to 90%. In this case, this metric is marked in green in the console.

>  The instance connection usage is the maximum connection usage among all the coordinator and compute nodes.', example='healthy'),
      value?: float(name='Value', description='The metric value of instance connection usage.

Unit: %.', example='1.71'),
    }(name='adbpg_connection_status', description='The information of instance connection health status.'),
    adbpgDiskStatus?: {
      status?: string(name='Status', description='The storage status of the instance. Valid values:

*   **critical**: The instance storage usage is greater than or equal to 90%. In this case, this metric is marked in red in the console and the instance is locked.
*   **warning**: The instance storage usage is greater than or equal to 70% and less than 90%. In this case, this metric is marked in yellow in the console.
*   **healthy**: The instance storage usage is less than 70%. In this case, this metric is marked in green in the console.

>  The instance storage usage is the average storage usage of all compute nodes.', example='healthy'),
      value?: float(name='Value', description='The metric value of instance storage usage.

Unit: %.', example='1.52'),
    }(name='adbpg_disk_status', description='The information of instance storage status.

>  This parameter value is returned only for instances in elastic storage mode.'),
    adbpgDiskUsagePercent?: {
      status?: string(name='Status', description='The status corresponding to the storage usage of the instance. Valid values:

*   **critical**: The instance storage usage is greater than or equal to 90%. In this case, the instance is locked.
*   **warning**: The instance storage usage is greater than or equal to 70% and less than 90%.
*   **healthy**: The instance storage usage is less than 70%.

>  The instance storage usage is the average storage usage of all compute nodes.', example='healthy'),
      value?: float(name='Value', description='The metric value of instance storage usage.

Unit: %.', example='1.52'),
    }(name='adbpg_disk_usage_percent', description='The information of instance storage usage.

>  This parameter value is returned only for instances in elastic storage mode.'),
    adbpgInstanceColdDataGb?: {
      value?: float(name='Value', description='The total amount of cold data storage. Unit: GB.', example='0'),
    }(name='adbpg_instance_cold_data_gb', description='The total amount of cold data storage.'),
    adbpgInstanceHotDataGb?: {
      value?: float(name='Value', description='The total amount of hot data storage. Unit: GB.', example='4.1'),
    }(name='adbpg_instance_hot_data_gb', description='The total amount of hot data storage.'),
    adbpgInstanceTotalDataGb?: {
      value?: float(name='Value', description='The total amount of data storage of the instance. Unit: GB.', example='4.1'),
    }(name='adbpg_instance_total_data_gb', description='The total amount of data storage of the instance.'),
    adbpgMasterDiskUsagePercentMax?: {
      status?: string(name='Status', description='The status corresponding to the maximum storage usage of the coordinator node. Valid values:

*   **critical**: The coordinator node storage usage is greater than or equal to 90%. In this case, the instance is locked.
*   **warning**: The coordinator node storage usage is greater than or equal to 70% and less than 90%.
*   **healthy**: The coordinator node storage usage is less than 70%.', example='healthy'),
      value?: float(name='Value', description='The metric value of maximum coordinator node storage usage.

Unit: %.', example='1.34'),
    }(name='adbpg_master_disk_usage_percent_max', description='The information of maximum coordinator node storage usage.

>  This parameter value is returned only for instances in elastic storage mode.'),
    adbpgMasterStatus?: {
      status?: string(name='Status', description='The availability status of the coordinator node. Valid values:

*   **critical**: Both the primary and standby coordinator nodes are unavailable. In this case, this metric is marked in red in the console.
*   **warning**: The primary or standby coordinator node is unavailable. In this case, this metric is marked in yellow in the console.
*   **healthy**: Both the primary and standby coordinator nodes are available. In this case, this metric is marked in green in the console.', example='healthy'),
      value?: float(name='Value', description='The metric value of coordinator node availability status. Valid values:', example='1'),
    }(name='adbpg_master_status', description='The information of coordinator node availability status.'),
    adbpgSegmentStatus?: {
      status?: string(name='Status', description='The availability status of compute nodes. Valid values:

*   **critical**: All the primary and secondary compute nodes are unavailable. In this case, this metric is marked in red in the console.
*   **warning**: Fifty percent or more than fifty percent of compute nodes are unavailable. In this case, this metric is marked in yellow in the console.
*   **healthy**: All compute nodes are available. In this case, this metric is marked in green in the console.', example='healthy'),
      value?: float(name='Value', description='The metric value of compute node availability status.', example='1'),
    }(name='adbpg_segment_status', description='The information of compute node availability status.'),
    adbpgStatus?: {
      status?: string(name='Status', description='The health status of the instance. Valid values:

*   **critical**: The coordinator node or a compute node is unavailable. In this case, this metric is marked in red in the console.
*   **healthy**: All nodes are available. In this case, this metric is marked in green in the console.', example='healthy'),
      value?: float(name='Value', description='The metric value of instance health status. Valid values:

*   **1**: healthy
*   **0**: critical', example='1'),
    }(name='adbpg_status', description='The information of instance health status.'),
    nodeMasterConnectionStatus?: {
      status?: string(name='Status', description='The connection health status of the coordinator node. Valid values:

*   **critical**: The coordinator node connection usage is greater than 95%. In this case, this metric is marked in red in the console.
*   **warning**: The coordinator node connection usage is greater than or equal to 90% and less than 95%. In this case, this metric is marked in yellow in the console.
*   **healthy**: The coordinator node connection usage is less than 90%. In this case, this metric is marked in green in the console.

>  The coordinator node connection usage is the maximum connection usage of the coordinator node.', example='healthy'),
      value?: float(name='Value', description='The metric value of coordinator node connection usage.

Unit: %.', example='1.71'),
    }(name='node_master_connection_status', description='The information of coordinator node connection health status.'),
    nodeMasterStatus?: {
      status?: string(name='Status', description='The health status of the coordinator node. Valid values:

*   **critical**: The primary or standby coordinator node is unavailable. In this case, this metric is marked in red in the console.
*   **healthy**: Both the primary and standby coordinator nodes are available. In this case, this metric is marked in green in the console.', example='healthy'),
      value?: float(name='Value', description='The metric value of coordinator node health status. Valid values:

*   **1**: healthy
*   **0**: critical', example='1'),
    }(name='node_master_status', description='The information of coordinator node health status.'),
    nodeSegmentConnectionStatus?: {
      status?: string(name='Status', description='The connection health status of compute nodes. Valid values:

*   **critical**: The compute node connection usage is greater than or equal to 95%. In this case, this metric is marked in red in the console.
*   **warning**: The compute node connection usage is greater than or equal to 90% and less than 95%. In this case, this metric is marked in yellow in the console.
*   **healthy**: The compute node connection usage is less than 90%. In this case, this metric is marked in green in the console.

>  The compute node connection usage is the maximum connection usage among all compute nodes.', example='healthy'),
      value?: float(name='Value', description='The metric value of maximum compute node connection usage.

Unit: %.', example='0.48'),
    }(name='node_segment_connection_status', description='The information of compute node connection health status.'),
    nodeSegmentDiskStatus?: {
      status?: string(name='Status', description='The storage status of compute nodes. Valid values:

*   **critical**: The compute node storage usage is greater than or equal to 90%. In this case, this metric is marked in red in the console and the instance is locked.
*   **warning**: The compute node storage usage is greater than or equal to 80% and less than 90%. In this case, this metric is marked in yellow in the console.
*   **healthy**: The compute node storage usage is less than 80%. In this case, this metric is marked in green in the console.

>  The compute node storage usage is the maximum storage usage among all compute nodes.', example='healthy'),
      value?: float(name='Value', description='The metric value of maximum compute node storage usage.

Unit: %.', example='1.52'),
    }(name='node_segment_disk_status', description='The information of compute node storage status.

>  This parameter value is returned only for instances in elastic storage mode.'),
  }(name='Status', description='The queried performance metrics. Each performance metric consists of the parameter name, status, and metric value. The metric information is returned only for the performance parameters specified by **Key**. For example, if you set **Key** to **adbpg_status**, only the metric information of **adbpg_status** is returned.

For more information about performance parameters, see [Performance parameters](https://help.aliyun.com/document_detail/86943.html).', example='{"node_master_connection_status":{"Status":"healthy","Value":1.6}}'),
}

model DescribeHealthStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHealthStatusResponseBody(name='body'),
}

/**
 * @summary Queries the health status of an AnalyticDB for PostgreSQL instance and its nodes.
 *
 * @description This operation is called to query the health status of an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode and its coordinator and compute nodes.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeHealthStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHealthStatusResponse
 */
async function describeHealthStatusWithOptions(request: DescribeHealthStatusRequest, runtime: Util.RuntimeOptions): DescribeHealthStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHealthStatus',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the health status of an AnalyticDB for PostgreSQL instance and its nodes.
 *
 * @description This operation is called to query the health status of an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode and its coordinator and compute nodes.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeHealthStatusRequest
 * @return DescribeHealthStatusResponse
 */
async function describeHealthStatus(request: DescribeHealthStatusRequest): DescribeHealthStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHealthStatusWithOptions(request, runtime);
}

model DescribeIMVInfosRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='testdb'),
  MVName?: string(name='MVName', description='The name of MV', example='public."mv1"'),
}

model DescribeIMVInfosResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.', example='gp-xxxxxxxxx'),
  imvInfos?: [ 
    {
      base?: string(name='Base', description='The name of the table based on which the materialized view is created.', example='"public."t2"'),
      detailInfo?: string(name='DetailInfo', description='The dependency between the materialized view and the base table and all metric values, which can be used to build a lineage graph.', example='{\\\\"maintenance_calls\\\\" : 1, \\\\"avg_apply_time\\\\" : 2, \\\\"avg_calc_rows\\\\" : 1, \\\\"avg_calc_time\\\\" : 11, \\\\"avg_delta_rows\\\\" : 1, \\\\"avg_maintenance_total_time\\\\" : 14, \\\\"avg_maintenance_total_time_total\\\\" : 14, \\\\"max_apply_time\\\\" : 2, \\\\"max_calc_rows\\\\" : 1, \\\\"max_calc_time\\\\" : 11, \\\\"max_delta_rows\\\\" : 1, \\\\"max_maintenance_total_time\\\\" : 14, \\\\"max_maintenance_total_time_total\\\\" : 14, \\\\"min_apply_time\\\\" : 2, \\\\"min_calc_rows\\\\" : 1, \\\\"min_calc_time\\\\" : 11, \\\\"min_delta_rows\\\\" : 1, \\\\"min_maintenance_total_time\\\\" : 14, \\\\"min_maintenance_total_time_total\\\\" : 14, \\\\"max_outerjoin_apply_time\\\\" : null, \\\\"max_outerjoin_calc_rows\\\\" : null, \\\\"max_outerjoin_calc_time\\\\" : null, \\\\"max_outerjoin_delta_rows\\\\" : null, \\\\"avg_outerjoin_apply_time\\\\" : null, \\\\"avg_outerjoin_calc_rows\\\\" : null, \\\\"avg_outerjoin_calc_time\\\\" : null, \\\\"avg_outerjoin_delta_rows\\\\" : null, \\\\"min_outerjoin_apply_time\\\\" : null, \\\\"min_outerjoin_calc_rows\\\\" : null, \\\\"min_outerjoin_calc_time\\\\" : null, \\\\"min_outerjoin_delta_rows\\\\" : null, \\\\"create_rows\\\\" : null, \\\\"create_time\\\\" : null, \\\\"direct_visited\\\\" : null, \\\\"indirect_visited\\\\" : null, \\\\"max_refresh_rows\\\\" : null, \\\\"max_refresh_time\\\\" : null, \\\\"avg_refresh_rows\\\\" : null, \\\\"avg_refresh_time\\\\" : null, \\\\"min_refresh_rows\\\\" : null, \\\\"min_refresh_time\\\\" : null, \\\\"refresh_calls\\\\" : null, \\\\"avg_wait_lock_time\\\\" : null, \\\\"max_wait_lock_time\\\\" : null, \\\\"min_wait_lock_time\\\\" : null, \\\\"latest_maintenance_time\\\\" : \\\\"2023-08-09T07:39:14.753252+00:00\\\\"}'),
      MV?: string(name='MV', description='The name of the materialized view.', example='public."mv1"'),
    }
  ](name='ImvInfos', description='The queried materialized views.'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model DescribeIMVInfosResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeIMVInfosResponseBody(name='body'),
}

/**
 * @summary Queries the information about real-time materialized views of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeIMVInfosRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeIMVInfosResponse
 */
async function describeIMVInfosWithOptions(request: DescribeIMVInfosRequest, runtime: Util.RuntimeOptions): DescribeIMVInfosResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.MVName)) {
    query['MVName'] = request.MVName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeIMVInfos',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about real-time materialized views of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeIMVInfosRequest
 * @return DescribeIMVInfosResponse
 */
async function describeIMVInfos(request: DescribeIMVInfosRequest): DescribeIMVInfosResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeIMVInfosWithOptions(request, runtime);
}

model DescribeIndexRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  indexName?: string(name='IndexName', description='This parameter is required.', example='testindex'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model DescribeIndexResponseBody = {
  collection?: string(name='Collection', example='testcollection'),
  indexDef?: string(name='IndexDef', example='CREATE INDEX testindex ON mynamespace. testcollection'),
  indexName?: string(name='IndexName', example='testindex'),
  message?: string(name='Message', example='success'),
  namespace?: string(name='Namespace', example='mynamespace'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model DescribeIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeIndexResponseBody(name='body'),
}

/**
 * @summary 获取索引详情
 *
 * @param request DescribeIndexRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeIndexResponse
 */
async function describeIndexWithOptions(request: DescribeIndexRequest, runtime: Util.RuntimeOptions): DescribeIndexResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.indexName)) {
    query['IndexName'] = request.indexName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeIndex',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取索引详情
 *
 * @param request DescribeIndexRequest
 * @return DescribeIndexResponse
 */
async function describeIndex(request: DescribeIndexRequest): DescribeIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeIndexWithOptions(request, runtime);
}

model DescribeJDBCDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxx'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.

This parameter is required.', example='123'),
}

model DescribeJDBCDataSourceResponseBody = {
  createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
  dataSourceDescription?: string(name='DataSourceDescription', description='The description of the service. The description can be up to 256 characters in length.', example='mysql data source config'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.', example='123'),
  dataSourceName?: string(name='DataSourceName', description='The name of data soruce', example='hdfs_pxf'),
  dataSourceStatus?: string(name='DataSourceStatus', description='The status of the service. Valid values:

*   Init
*   Running
*   Exception', example='Running'),
  dataSourceType?: string(name='DataSourceType', description='The type of the data source.', example='MySQL'),
  externalDataServiceId?: string(name='ExternalDataServiceId', description='The id of the external data service', example='2989'),
  JDBCConnectionString?: string(name='JDBCConnectionString', description='The JDBC connection string.', example='xxxxxx'),
  JDBCPassword?: string(name='JDBCPassword', description='The password of the database account.', example='xxxxxx'),
  JDBCUserName?: string(name='JDBCUserName', description='The name of the database account.', example='xxxxxx'),
  modifyTime?: string(name='ModifyTime', description='The time when the data source was last modified.', example='2024-08-27T02:01:10Z'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  statusMessage?: string(name='StatusMessage', description='The message of the status', example='""'),
}

model DescribeJDBCDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeJDBCDataSourceResponseBody(name='body'),
}

/**
 * @summary Queries the configurations of a Java Database Connectivity (JDBC) data source.
 *
 * @param request DescribeJDBCDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeJDBCDataSourceResponse
 */
async function describeJDBCDataSourceWithOptions(request: DescribeJDBCDataSourceRequest, runtime: Util.RuntimeOptions): DescribeJDBCDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeJDBCDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the configurations of a Java Database Connectivity (JDBC) data source.
 *
 * @param request DescribeJDBCDataSourceRequest
 * @return DescribeJDBCDataSourceResponse
 */
async function describeJDBCDataSource(request: DescribeJDBCDataSourceRequest): DescribeJDBCDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeJDBCDataSourceWithOptions(request, runtime);
}

model DescribeLogBackupsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. The end time must be later than the start time. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

This parameter is required.', example='2022-12-12T03:00Z'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. The value must be an integer that is greater than 0. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

This parameter is required.', example='2022-12-12T02:00Z'),
}

model DescribeLogBackupsResponseBody = {
  items?: [ 
    {
      backupId?: string(name='BackupId', description='The ID of the backup set.', example='12413721782'),
      DBInstanceId?: string(name='DBInstanceId', description='The ID of the coordinator node.', example='gp-bp12ga6v69h86****-master'),
      logFileName?: string(name='LogFileName', description='The name of the log backup set that is stored in Object Storage Service (OSS).', example='000000010000000400000012'),
      logFileSize?: long(name='LogFileSize', description='The size of the log backup set. Unit: bytes.', example='77350'),
      logTime?: string(name='LogTime', description='The timestamp of the log.', example='2022-12-12T02:14:26Z'),
      segmentName?: string(name='SegmentName', description='The name of the compute node.', example='segment-0'),
    }
  ](name='Items', description='Details of the backup sets.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of backup sets on the current page.', example='30'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='24B9FCAF-2CBC-51C3-B563-F1C70D750187'),
  totalCount?: int32(name='TotalCount', description='The total number of entries.', example='5'),
  totalLogSize?: long(name='TotalLogSize', description='The total size of logs in the time range. Unit: bytes.', example='386748'),
}

model DescribeLogBackupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLogBackupsResponseBody(name='body'),
}

/**
 * @summary Queries a list of log backups.
 *
 * @param request DescribeLogBackupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLogBackupsResponse
 */
async function describeLogBackupsWithOptions(request: DescribeLogBackupsRequest, runtime: Util.RuntimeOptions): DescribeLogBackupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLogBackups',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of log backups.
 *
 * @param request DescribeLogBackupsRequest
 * @return DescribeLogBackupsResponse
 */
async function describeLogBackups(request: DescribeLogBackupsRequest): DescribeLogBackupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLogBackupsWithOptions(request, runtime);
}

model DescribeModifyParameterLogRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxx'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC. The end time must be later than the start time.', example='2020-05-05T11:22:22Z'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC.', example='2020-02-02T11:22:22Z'),
}

model DescribeModifyParameterLogResponseBody = {
  changelogs?: [ 
    {
      effectTime?: string(name='EffectTime', description='The effective time.', example='2020-05-05T11:22:22Z'),
      parameterName?: string(name='ParameterName', description='The name of the parameter.', example='testkey'),
      parameterValid?: string(name='ParameterValid', description='Indicates whether the modification takes effect.', example='true'),
      parameterValueAfter?: string(name='ParameterValueAfter', description='The original value of the parameter.', example='100'),
      parameterValueBefore?: string(name='ParameterValueBefore', description='The new value of the parameter.', example='200'),
    }
  ](name='Changelogs', description='The queried parameter modification logs.'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396F2CAD1'),
}

model DescribeModifyParameterLogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeModifyParameterLogResponseBody(name='body'),
}

/**
 * @summary Queries the parameter modification logs of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeModifyParameterLogRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeModifyParameterLogResponse
 */
async function describeModifyParameterLogWithOptions(request: DescribeModifyParameterLogRequest, runtime: Util.RuntimeOptions): DescribeModifyParameterLogResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeModifyParameterLog',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the parameter modification logs of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeModifyParameterLogRequest
 * @return DescribeModifyParameterLogResponse
 */
async function describeModifyParameterLog(request: DescribeModifyParameterLogRequest): DescribeModifyParameterLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeModifyParameterLogWithOptions(request, runtime);
}

model DescribeNamespaceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.

This parameter is required.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model DescribeNamespaceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  namespace?: string(name='Namespace', description='The name of the namespace.', example='mynamespace'),
  namespaceInfo?: map[string]string(name='NamespaceInfo', description='The queried namespace.'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DescribeNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespaceResponseBody(name='body'),
}

/**
 * @summary Queries the information about a namespace.
 *
 * @param request DescribeNamespaceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNamespaceResponse
 */
async function describeNamespaceWithOptions(request: DescribeNamespaceRequest, runtime: Util.RuntimeOptions): DescribeNamespaceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespace',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a namespace.
 *
 * @param request DescribeNamespaceRequest
 * @return DescribeNamespaceResponse
 */
async function describeNamespace(request: DescribeNamespaceRequest): DescribeNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeNamespaceWithOptions(request, runtime);
}

model DescribeParametersRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
}

model DescribeParametersResponseBody = {
  parameters?: [ 
    {
      currentValue?: string(name='CurrentValue', description='The current value of the configuration parameter.', example='10800000'),
      forceRestartInstance?: string(name='ForceRestartInstance', description='Indicates whether a restart is required for parameter modifications to take effect. Valid values:

*   **true**
*   **false**', example='false'),
      isChangeableConfig?: string(name='IsChangeableConfig', description='Indicates whether the configuration parameter can be modified. Valid values:

*   **true**
*   **false**', example='true'),
      optionalRange?: string(name='OptionalRange', description='The valid values of the configuration parameter.', example='[0-2147483647]'),
      parameterDescription?: string(name='ParameterDescription', description='The description of the configuration parameter.', example='Sets the maximum allowed duration of any statement, A value of 0 turns off the timeout.'),
      parameterName?: string(name='ParameterName', description='The name of the configuration parameter.', example='statement_timeout'),
      parameterValue?: string(name='ParameterValue', description='The default value of the configuration parameter.', example='10800000'),
    }
  ](name='Parameters', description='The queried configuration parameters.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='62506167-D284-562A-B7C2-0A**********'),
}

model DescribeParametersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeParametersResponseBody(name='body'),
}

/**
 * @summary Queries the information about configuration parameters for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation can be called to query the details of parameters in an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeParametersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeParametersResponse
 */
async function describeParametersWithOptions(request: DescribeParametersRequest, runtime: Util.RuntimeOptions): DescribeParametersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeParameters',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about configuration parameters for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation can be called to query the details of parameters in an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeParametersRequest
 * @return DescribeParametersResponse
 */
async function describeParameters(request: DescribeParametersRequest): DescribeParametersResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeParametersWithOptions(request, runtime);
}

model DescribeRdsVSwitchsRequest {
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list and zone list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
  vpcId?: string(name='VpcId', description='The virtual private cloud (VPC) ID of the instance.

> 

*   You can call the [DescribeRdsVpcs](https://help.aliyun.com/document_detail/208327.html) operation to query the available VPC IDs.

*   This parameter must be specified.', example='vpc-bp*******************'),
  zoneId?: string(name='ZoneId', description='The ID of the zone.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list and zone list.', example='cn-hangzhou-h'),
}

model DescribeRdsVSwitchsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='B0BA251D-6854-5A99-A964-3C**********'),
  vSwitches?: {
    vSwitch?: [ 
      {
        aliUid?: string(name='AliUid', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        bid?: string(name='Bid', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        cidrBlock?: string(name='CidrBlock', description='The CIDR block of the vSwitch.', example='192.**.**.0/24'),
        gmtCreate?: string(name='GmtCreate', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        gmtModified?: string(name='GmtModified', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        isDefault?: boolean(name='IsDefault', description='Indicates whether the vSwitch is the default vSwitch. Valid values:

*   **true**
*   **false**', example='false'),
        izNo?: string(name='IzNo', description='The ID of the zone.', example='cn-hangzhou-h'),
        regionNo?: string(name='RegionNo', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        status?: string(name='Status', description='The state of the vSwitch. If **Available** is returned, the vSwitch is available.', example='Available'),
        vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch.', example='vsw-bp*******************'),
        vSwitchName?: string(name='VSwitchName', description='The name of the vSwitch.', example='vsw-name'),
      }
    ](name='VSwitch', description='Details of the vSwitch.'),
  }(name='VSwitches', description='Details of the vSwitches.'),
}

model DescribeRdsVSwitchsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRdsVSwitchsResponseBody(name='body'),
}

/**
 * @summary Queries a list of vSwitches.
 *
 * @description When you create AnalyticDB for PostgreSQL instances, you can call this operation to query the details of vSwitches within a specified region or zone.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRdsVSwitchsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRdsVSwitchsResponse
 */
async function describeRdsVSwitchsWithOptions(request: DescribeRdsVSwitchsRequest, runtime: Util.RuntimeOptions): DescribeRdsVSwitchsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRdsVSwitchs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of vSwitches.
 *
 * @description When you create AnalyticDB for PostgreSQL instances, you can call this operation to query the details of vSwitches within a specified region or zone.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRdsVSwitchsRequest
 * @return DescribeRdsVSwitchsResponse
 */
async function describeRdsVSwitchs(request: DescribeRdsVSwitchsRequest): DescribeRdsVSwitchsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRdsVSwitchsWithOptions(request, runtime);
}

model DescribeRdsVpcsRequest {
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
  zoneId?: string(name='ZoneId', description='The ID of the zone.', example='cn-hangzhou-h'),
}

model DescribeRdsVpcsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='53924AF0-1628-5AA2-9C95-D4**********'),
  vpcs?: {
    vpc?: [ 
      {
        aliUid?: string(name='AliUid', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        bid?: string(name='Bid', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        cidrBlock?: string(name='CidrBlock', description='The CIDR block of the VPC.', example='10.**.**.0/8'),
        gmtCreate?: string(name='GmtCreate', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        gmtModified?: string(name='GmtModified', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
        isDefault?: boolean(name='IsDefault', description='Indicates whether the VPC is the default VPC. Valid values:

*   **true**
*   **false**', example='true'),
        regionNo?: string(name='RegionNo', description='The region ID of the instance.', example='cn-hangzhou'),
        status?: string(name='Status', description='The state of the VPC. If **Available** is returned, the VPC is available.', example='Available'),
        vSwitchs?: [ 
          {
            cidrBlock?: string(name='CidrBlock', description='The CIDR block of the vSwitch.', example='10.**.**.0/24'),
            gmtCreate?: string(name='GmtCreate', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
            gmtModified?: string(name='GmtModified', description='An invalid parameter. It is no longer returned when you call this operation.', example='null'),
            isDefault?: boolean(name='IsDefault', description='Indicates whether the vSwitch is the default vSwitch. Valid values:

*   **true**
*   **false**', example='true'),
            izNo?: string(name='IzNo', description='The ID of the zone to which the vSwitch belongs.', example='cn-hangzhou-i'),
            status?: string(name='Status', description='The state of the vSwitch. If **Available** is returned, the vSwitch is available.', example='Available'),
            vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-bp*******************'),
            vSwitchName?: string(name='VSwitchName', description='The name of the vSwitch.', example='vsw-name'),
          }
        ](name='VSwitchs', description='The queried vSwitches.'),
        vpcId?: string(name='VpcId', description='The VPC ID.', example='vpc-bp*******************'),
        vpcName?: string(name='VpcName', description='The name of the VPC.', example='vpc-name'),
      }
    ](name='Vpc', description='The queried VPC.'),
  }(name='Vpcs', description='The queried VPCs.'),
}

model DescribeRdsVpcsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRdsVpcsResponseBody(name='body'),
}

/**
 * @summary Queries a list of VPCs.
 *
 * @description When you create an AnalyticDB for PostgreSQL instance, you can call this operation to query the available VPCs within a specified region or zone.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRdsVpcsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRdsVpcsResponse
 */
async function describeRdsVpcsWithOptions(request: DescribeRdsVpcsRequest, runtime: Util.RuntimeOptions): DescribeRdsVpcsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRdsVpcs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of VPCs.
 *
 * @description When you create an AnalyticDB for PostgreSQL instance, you can call this operation to query the available VPCs within a specified region or zone.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRdsVpcsRequest
 * @return DescribeRdsVpcsResponse
 */
async function describeRdsVpcs(request: DescribeRdsVpcsRequest): DescribeRdsVpcsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRdsVpcsWithOptions(request, runtime);
}

model DescribeRegionsRequest {
  region?: string(name='Region', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model DescribeRegionsResponseBody = {
  regions?: {
    region?: [ 
    {
      regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
      zones?: {
        zone?: [ 
        {
          vpcEnabled?: boolean(name='VpcEnabled', description='Indicates whether Virtual Private Cloud (VPC) is available.

*   **true**: VPC is available.
*   **false**: VPC is unavailable.', example='true'),
          zoneId?: string(name='ZoneId', description='The ID of the zone.', example='cn-hangzhou-c'),
        }
      ](name='Zone')
      }(name='Zones', description='Details of the zones.'),
    }
  ](name='Region')
  }(name='Regions', description='Details of the regions.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='FF8EB261-5447-4B1B-9F14-294CEA008A9F'),
}

model DescribeRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRegionsResponseBody(name='body'),
}

/**
 * @summary Queries a list of regions and zones where AnalyticDB for PostgreSQL is available.
 *
 * @description Before you create an AnalyticDB for PostgreSQL instance, you must call this operation to query available regions and zones.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRegionsResponse
 */
async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of regions and zones where AnalyticDB for PostgreSQL is available.
 *
 * @description Before you create an AnalyticDB for PostgreSQL instance, you must call this operation to query available regions and zones.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeRegionsRequest
 * @return DescribeRegionsResponse
 */
async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeRolesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model DescribeRolesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  roleList?: {
    role?: [ string ](name='Role')
  }(name='RoleList', description='The roles.'),
}

model DescribeRolesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRolesResponseBody(name='body'),
}

/**
 * @summary Queries a list of roles.
 *
 * @param request DescribeRolesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRolesResponse
 */
async function describeRolesWithOptions(request: DescribeRolesRequest, runtime: Util.RuntimeOptions): DescribeRolesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRoles',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of roles.
 *
 * @param request DescribeRolesRequest
 * @return DescribeRolesResponse
 */
async function describeRoles(request: DescribeRolesRequest): DescribeRolesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRolesWithOptions(request, runtime);
}

model DescribeSQLLogCountRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxx'),
  database?: string(name='Database', description='The name of the database.', example='testdb'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.

> The end time must be later than the start time. The maximum time range that can be specified is seven days.

This parameter is required.', example='2020-12-14T11:22Z'),
  executeCost?: string(name='ExecuteCost', description='The execution duration of the SQL statement. Unit: seconds.', example='100'),
  executeState?: string(name='ExecuteState', description='The execution status of the query. Valid values:

*   1: successful.
*   0: failed.
*   0,1 or 1,0: all.', example='success'),
  maxExecuteCost?: string(name='MaxExecuteCost', description='The maximum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='1000'),
  minExecuteCost?: string(name='MinExecuteCost', description='The minimum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='10'),
  operationClass?: string(name='OperationClass', description='The type of the query language. Valid values:

*   **DQL**
*   **DML**
*   **DDL**
*   **DCL**
*   **TCL**', example='DQL'),
  operationType?: string(name='OperationType', description='The type of the SQL statement.

> 

*   If you specify **OperationClass**, the value of **OperationType** must be of the corresponding query language. For example, if you set **OperationClass** to **DQL**, the value of **OperationType** must be a **DQL** statement such as **SELECT**.

*   If you leave **OperationClass** empty, the value of **OperationType** can be an SQL statement of any query language.

*   If you leave **OperationClass** and **OperationType** empty, all types of SQL statements are returned.', example='SELECT'),
  queryKeywords?: string(name='QueryKeywords', description='The keywords that are used to query audit logs.', example='test'),
  sourceIP?: string(name='SourceIP', description='The source IP address.', example='10.**.**.13'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.

This parameter is required.', example='2020-12-12T11:22Z'),
  user?: string(name='User', description='The name of the database account that is used to connect to the database.', example='adbpgadmin'),
}

model DescribeSQLLogCountResponseBody = {
  DBClusterId?: string(name='DBClusterId', description='The instance ID.', example='gp-xxxxxxxx'),
  endTime?: string(name='EndTime', description='The end time of the query.', example='2020-12-14T11:22Z'),
  items?: [ 
    {
      name?: string(name='Name', description='The name of the table.', example='gp-xxxxxxxx'),
      series?: [ 
        {
          values?: [ 
            {
              point?: [ string ](name='Point', description='The time when the audit logs were generated and the number of the audit logs.'),
            }
          ](name='Values', description='Details of the audit logs.'),
        }
      ](name='Series', description='Details of the audit logs.'),
    }
  ](name='Items', description='The name of the instance.'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A**********'),
  startTime?: string(name='StartTime', description='The start time of the query.', example='2020-12-12T11:22Z'),
}

model DescribeSQLLogCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSQLLogCountResponseBody(name='body'),
}

/**
 * @summary Queries the number of audit logs for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 *
 * @param request DescribeSQLLogCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSQLLogCountResponse
 */
async function describeSQLLogCountWithOptions(request: DescribeSQLLogCountRequest, runtime: Util.RuntimeOptions): DescribeSQLLogCountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executeCost)) {
    query['ExecuteCost'] = request.executeCost;
  }
  if (!Util.isUnset(request.executeState)) {
    query['ExecuteState'] = request.executeState;
  }
  if (!Util.isUnset(request.maxExecuteCost)) {
    query['MaxExecuteCost'] = request.maxExecuteCost;
  }
  if (!Util.isUnset(request.minExecuteCost)) {
    query['MinExecuteCost'] = request.minExecuteCost;
  }
  if (!Util.isUnset(request.operationClass)) {
    query['OperationClass'] = request.operationClass;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.queryKeywords)) {
    query['QueryKeywords'] = request.queryKeywords;
  }
  if (!Util.isUnset(request.sourceIP)) {
    query['SourceIP'] = request.sourceIP;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSQLLogCount',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the number of audit logs for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 *
 * @param request DescribeSQLLogCountRequest
 * @return DescribeSQLLogCountResponse
 */
async function describeSQLLogCount(request: DescribeSQLLogCountRequest): DescribeSQLLogCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSQLLogCountWithOptions(request, runtime);
}

model DescribeSQLLogsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-xxxxxxxx'),
  database?: string(name='Database', description='The name of the database.', example='adbpgadmin'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC.

> The end time must be later than the start time. The maximum time range that can be specified is seven days.

This parameter is required.', example='2021-03-17T06:30Z'),
  executeCost?: string(name='ExecuteCost', description='The execution duration of the SQL statement. Unit: seconds.', example='1'),
  executeState?: string(name='ExecuteState', description='The execution status of the SQL statement. Valid values:

*   **1**: successful.
*   **0**: failed.', example='success'),
  maxExecuteCost?: string(name='MaxExecuteCost', description='The maximum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='1000'),
  minExecuteCost?: string(name='MinExecuteCost', description='The minimum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='1'),
  operationClass?: string(name='OperationClass', description='The type of the query language. Valid values:

*   **DQL**
*   **DML**
*   **DDL**
*   **DCL**
*   **TCL**', example='DQL'),
  operationType?: string(name='OperationType', description='The type of the SQL statement.

> 

*   If **OperationClass** is specified, the value of **OperationType** must belong to the corresponding query language. For example, if **OperationClass** is set to **DQL**, the value of **OperationType** must be a **DQL** statement such as **SELECT**.

*   If **OperationClass** is not specified, the value of **OperationType** can be an SQL statement of any query language.
*   If **OperationClass** and **OperationType** are not specified, all types of SQL statements are returned.', example='SELECT'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  queryKeywords?: string(name='QueryKeywords', description='The keywords of the SQL statement.', example='select 1'),
  sourceIP?: string(name='SourceIP', description='The source IP address.', example='100.**.**.90'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC.

This parameter is required.', example='2021-03-10T06:30Z'),
  user?: string(name='User', description='The name of the database account.', example='testadmin'),
}

model DescribeSQLLogsResponseBody = {
  items?: [ 
    {
      accountName?: string(name='AccountName', description='The database account that executes the SQL statement.', example='testadmin'),
      DBName?: string(name='DBName', description='The name of the database.', example='adbpgadmin'),
      DBRole?: string(name='DBRole', description='The role of the database.', example='master'),
      executeCost?: float(name='ExecuteCost', description='The execution duration of the SQL statement.', example='2'),
      executeState?: string(name='ExecuteState', description='The execution status of the SQL statement. Valid values:

*   **success**
*   **fail**', example='success'),
      operationClass?: string(name='OperationClass', description='The type of the query language.', example='DQL'),
      operationExecuteTime?: string(name='OperationExecuteTime', description='The time when the SQL statement was executed.', example='2021-03-15T17:02:32Z'),
      operationType?: string(name='OperationType', description='The type of the SQL statement.', example='SELECT'),
      returnRowCounts?: long(name='ReturnRowCounts', description='The total number of entries returned.', example='1'),
      SQLPlan?: string(name='SQLPlan', description='The SQL execution plan.', example='""'),
      SQLText?: string(name='SQLText', description='The SQL statement.', example='select 1'),
      scanRowCounts?: long(name='ScanRowCounts', description='The number of entries scanned.', example='1'),
      sourceIP?: string(name='SourceIP', description='The source IP address.', example='100.**.**.90'),
      sourcePort?: int32(name='SourcePort', description='The number of the source port.', example='50514'),
    }
  ](name='Items', description='The queried SQL execution logs.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='A7941C94-B92F-46A0-BD3E-2D**********'),
}

model DescribeSQLLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSQLLogsResponseBody(name='body'),
}

/**
 * @summary Queries the SQL execution logs of an AnalyticDB for PostgreSQL instance.
 *
 * @description > This operation is no longer used. To query SQL execution logs, call the [DescribeSQLLogsV2](https://help.aliyun.com/document_detail/453722.html) operation.
 *
 * @param request DescribeSQLLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSQLLogsResponse
 */
async function describeSQLLogsWithOptions(request: DescribeSQLLogsRequest, runtime: Util.RuntimeOptions): DescribeSQLLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executeCost)) {
    query['ExecuteCost'] = request.executeCost;
  }
  if (!Util.isUnset(request.executeState)) {
    query['ExecuteState'] = request.executeState;
  }
  if (!Util.isUnset(request.maxExecuteCost)) {
    query['MaxExecuteCost'] = request.maxExecuteCost;
  }
  if (!Util.isUnset(request.minExecuteCost)) {
    query['MinExecuteCost'] = request.minExecuteCost;
  }
  if (!Util.isUnset(request.operationClass)) {
    query['OperationClass'] = request.operationClass;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryKeywords)) {
    query['QueryKeywords'] = request.queryKeywords;
  }
  if (!Util.isUnset(request.sourceIP)) {
    query['SourceIP'] = request.sourceIP;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSQLLogs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the SQL execution logs of an AnalyticDB for PostgreSQL instance.
 *
 * @description > This operation is no longer used. To query SQL execution logs, call the [DescribeSQLLogsV2](https://help.aliyun.com/document_detail/453722.html) operation.
 *
 * @param request DescribeSQLLogsRequest
 * @return DescribeSQLLogsResponse
 */
async function describeSQLLogs(request: DescribeSQLLogsRequest): DescribeSQLLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSQLLogsWithOptions(request, runtime);
}

model DescribeSQLLogsV2Request {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxx'),
  database?: string(name='Database', description='The name of the database.', example='adbpgadmin'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC.

>  The end time must be later than the start time. The interval cannot be more than 24 hours.', example='2022-03-17T06:30Z'),
  executeCost?: string(name='ExecuteCost', description='The execution duration of the SQL statement. Unit: seconds.', example='1'),
  executeState?: string(name='ExecuteState', description='The execution status of the SQL statement. Valid values:

*   **1**: successful.
*   **0**: failed.', example='success'),
  maxExecuteCost?: string(name='MaxExecuteCost', description='The maximum amount of time consumed by a slow query. Minimum value: 0. Unit: seconds.', example='1000'),
  minExecuteCost?: string(name='MinExecuteCost', description='The minimum amount of time consumed by a slow query. Minimum value: 0. Unit: seconds.', example='1'),
  operationClass?: string(name='OperationClass', description='The type of the query language. Valid values:

*   **DQL**
*   **DML**
*   **DDL**
*   **DCL**
*   **TCL**', example='DQL'),
  operationType?: string(name='OperationType', description='The type of the SQL statement.

> *   If the **OperationClass** parameter is specified, the **OperationType** value must belong to the corresponding query language. For example, if the **OperationClass** value is **DQL**, the **OperationType** value must be a **DQL** SQL statement such as **SELECT**.
>*   If the **OperationClass** parameter is not specified, the **OperationType** value can be an SQL statement of all query languages.
>*   If neither of the **OperationClass** and **OperationType** parameters is specified, all types of SQL statements are returned.', example='SELECT'),
  pageNumber?: string(name='PageNumber', description='The number of entries to return on each page.', example='10'),
  pageSize?: string(name='PageSize', description='The number of the page to return. The maximum value is 200.', example='1'),
  queryKeywords?: string(name='QueryKeywords', description='The keywords of the SQL statement.', example='select 1'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-bp67acfmxazb4p****'),
  sourceIP?: string(name='SourceIP', description='The source IP address.', example='100.XX.XX.90'),
  startTime?: string(name='StartTime', description='The beginning of the time range. Specify the time in the ISO 8601 standard in the *yyyy-MM-ddTHH:mmZ* format. The time must be in UTC.', example='2022-03-10T06:30Z'),
  user?: string(name='User', description='The name of the database account.', example='testadmin'),
}

model DescribeSQLLogsV2ResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='account name invalid'),
  items?: [ 
    {
      accountName?: string(name='AccountName', description='The database account that executes the SQL statement.', example='testadmin'),
      DBName?: string(name='DBName', description='The name of the database.', example='adbpgadmin'),
      DBRole?: string(name='DBRole', description='The role of the database.', example='master'),
      errorCode?: string(name='ErrorCode', description='The error code.', example='InternalError'),
      errorMsg?: string(name='ErrorMsg', description='The error message.', example='User not authorized to operate on the specified resource.'),
      executeCost?: float(name='ExecuteCost', description='The execution duration of the SQL statement.', example='2'),
      executeState?: string(name='ExecuteState', description='The execution status of the SQL statement. Valid values:

*   **success**
*   **fail**', example='success'),
      operationClass?: string(name='OperationClass', description='The type of the query language.', example='DQL'),
      operationExecuteTime?: string(name='OperationExecuteTime', description='The time when the SQL statement was executed.', example='2021-03-15T17:02:32Z'),
      operationType?: string(name='OperationType', description='The type of the SQL statement.', example='SELECT'),
      queryId?: string(name='QueryId', description='The query ID.', example='2548026401648157601713924318883'),
      returnRowCounts?: long(name='ReturnRowCounts', description='The number of entries returned.', example='1'),
      SQLText?: string(name='SQLText', description='The SQL statement.', example='select 1'),
      scanRowCounts?: long(name='ScanRowCounts', description='The number of entries scanned.', example='1'),
      sessionId?: string(name='SessionId', description='The ID of the session.', example='efc33bd7-f1dc-4b24-b4fb-ab0d5329b7bb'),
      sourceIP?: string(name='SourceIP', description='The source IP address.', example='100.**.**.90'),
      sourcePort?: int32(name='SourcePort', description='The number of the source port.', example='50514'),
    }
  ](name='Items', description='The queried SQL execution logs.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries returned per page.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A7941C94-B92F-46A0-BD3E-2D**********'),
}

model DescribeSQLLogsV2Response = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSQLLogsV2ResponseBody(name='body'),
}

/**
 * @summary Queries SQL logs within a specific time range.
 *
 * @description You can call this operation to query SQL logs of an AnalyticDB for PostgreSQL instance within a specific time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeSQLLogsV2Request
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSQLLogsV2Response
 */
async function describeSQLLogsV2WithOptions(request: DescribeSQLLogsV2Request, runtime: Util.RuntimeOptions): DescribeSQLLogsV2Response {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executeCost)) {
    query['ExecuteCost'] = request.executeCost;
  }
  if (!Util.isUnset(request.executeState)) {
    query['ExecuteState'] = request.executeState;
  }
  if (!Util.isUnset(request.maxExecuteCost)) {
    query['MaxExecuteCost'] = request.maxExecuteCost;
  }
  if (!Util.isUnset(request.minExecuteCost)) {
    query['MinExecuteCost'] = request.minExecuteCost;
  }
  if (!Util.isUnset(request.operationClass)) {
    query['OperationClass'] = request.operationClass;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryKeywords)) {
    query['QueryKeywords'] = request.queryKeywords;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sourceIP)) {
    query['SourceIP'] = request.sourceIP;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSQLLogsV2',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries SQL logs within a specific time range.
 *
 * @description You can call this operation to query SQL logs of an AnalyticDB for PostgreSQL instance within a specific time range.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeSQLLogsV2Request
 * @return DescribeSQLLogsV2Response
 */
async function describeSQLLogsV2(request: DescribeSQLLogsV2Request): DescribeSQLLogsV2Response {
  var runtime = new Util.RuntimeOptions{};
  return describeSQLLogsV2WithOptions(request, runtime);
}

model DescribeSampleDataRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model DescribeSampleDataResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned if an error occurs. This message does not affect the execution of the operation.', example='******'),
  hasSampleData?: boolean(name='HasSampleData', description='Indicates whether a sample dataset is loaded to the instance. Valid values:

*   **true**: A sample dataset is loaded.
*   **false**: No sample dataset is loaded.', example='true'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='84CD7CAF-FA7B-5178-B19F-D8CDE307D5FA_8111'),
  sampleDataStatus?: string(name='SampleDataStatus', description='The loading status of the sample dataset. Valid values:

*   **loaded**
*   **loading**
*   **unload**', example='loaded'),
}

model DescribeSampleDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSampleDataResponseBody(name='body'),
}

/**
 * @summary Queries whether a sample dataset is loaded to an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeSampleDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSampleDataResponse
 */
async function describeSampleDataWithOptions(request: DescribeSampleDataRequest, runtime: Util.RuntimeOptions): DescribeSampleDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSampleData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether a sample dataset is loaded to an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeSampleDataRequest
 * @return DescribeSampleDataResponse
 */
async function describeSampleData(request: DescribeSampleDataRequest): DescribeSampleDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSampleDataWithOptions(request, runtime);
}

model DescribeStreamingDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-beijing'),
  serviceId?: string(name='ServiceId', description='The service ID.

This parameter is required.', example='1'),
}

model DescribeStreamingDataServiceResponseBody = {
  createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
  modifyTime?: string(name='ModifyTime', description='The time when the service was last modified.', example='2019-09-08T17:00:00Z'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceDescription?: string(name='ServiceDescription', description='The description of the service.', example='test-adbpgss'),
  serviceId?: string(name='ServiceId', description='The service ID.', example='1'),
  serviceIp?: string(name='ServiceIp', description='The IP address of the service.', example='192.168.0.1'),
  serviceManaged?: boolean(name='ServiceManaged', description='The service is managed by other aliyun product or not.', example='False'),
  serviceName?: string(name='ServiceName', description='The name of the service.', example='test-adbpgss'),
  serviceOwnerId?: string(name='ServiceOwnerId', description='The service account uid of the aliyun product', example='123456'),
  servicePort?: int32(name='ServicePort', description='The port number of the service.', example='5432'),
  serviceSpec?: string(name='ServiceSpec', description='The specifications of the service.', example='2'),
  status?: string(name='Status', description='The status of the service. Valid values:

*   Init
*   Running
*   Exception
*   Paused', example='Running'),
}

model DescribeStreamingDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeStreamingDataServiceResponseBody(name='body'),
}

/**
 * @summary Queries a real-time data service.
 *
 * @param request DescribeStreamingDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeStreamingDataServiceResponse
 */
async function describeStreamingDataServiceWithOptions(request: DescribeStreamingDataServiceRequest, runtime: Util.RuntimeOptions): DescribeStreamingDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeStreamingDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a real-time data service.
 *
 * @param request DescribeStreamingDataServiceRequest
 * @return DescribeStreamingDataServiceResponse
 */
async function describeStreamingDataService(request: DescribeStreamingDataServiceRequest): DescribeStreamingDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeStreamingDataServiceWithOptions(request, runtime);
}

model DescribeStreamingDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  dataSourceId?: int32(name='DataSourceId', description='Data source ID.

This parameter is required.', example='1'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
}

model DescribeStreamingDataSourceResponseBody = {
  createTime?: string(name='CreateTime', description='Creation time.', example='2019-09-08T16:00:00Z'),
  dataSourceConfig?: string(name='DataSourceConfig', description='Data source configuration information.', example='{"brokers":"broker0:9091,broker1:9091","topic":"topic"}'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Data source description.', example='test-kafka'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.', example='1'),
  dataSourceName?: string(name='DataSourceName', description='Data source name.', example='test-kafka'),
  dataSourceType?: string(name='DataSourceType', description='Data source type, values include:
 -  kafka', example='kafka'),
  errorMessage?: string(name='ErrorMessage', description='Service status message, for example, in case of an exception, it will show the reason for the exception. In normal Running state, this value is empty.', example='""'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceId?: int32(name='ServiceId', description='External data service ID.', example='1'),
  status?: string(name='Status', description='Service status:

- Initializing init

- Running running

- Exception exception', example='running'),
}

model DescribeStreamingDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeStreamingDataSourceResponseBody(name='body'),
}

/**
 * @summary Get external data source configuration information
 *
 * @param request DescribeStreamingDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeStreamingDataSourceResponse
 */
async function describeStreamingDataSourceWithOptions(request: DescribeStreamingDataSourceRequest, runtime: Util.RuntimeOptions): DescribeStreamingDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeStreamingDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get external data source configuration information
 *
 * @param request DescribeStreamingDataSourceRequest
 * @return DescribeStreamingDataSourceResponse
 */
async function describeStreamingDataSource(request: DescribeStreamingDataSourceRequest): DescribeStreamingDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeStreamingDataSourceWithOptions(request, runtime);
}

model DescribeStreamingJobRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  jobId?: int32(name='JobId', description='Job ID.

This parameter is required.', example='1'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface to view available region IDs.', example='cn-beijing'),
}

model DescribeStreamingJobResponseBody = {
  account?: string(name='Account', description='Target database account.', example='test-account'),
  consistency?: string(name='Consistency', description='Delivery guarantee.', example='ATLEAST / EXACTLY'),
  createTime?: string(name='CreateTime', description='Creation time.

Use the UTC time format: yyyy-MM-ddTHH:mm:ssZ', example='2019-09-08T16:00:00Z'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.', example='2'),
  dataSourceName?: string(name='DataSourceName', description='Data source name.', example='test_kafka'),
  destColumns?: [ string ](name='DestColumns', description='Target data table mapping field list.'),
  destDatabase?: string(name='DestDatabase', description='Target database name.', example='dest-db'),
  destSchema?: string(name='DestSchema', description='Target namespace.', example='dest-schema'),
  destTable?: string(name='DestTable', description='Target table name.', example='dest-table'),
  errorLimitCount?: int32(name='ErrorLimitCount', description='When data in Kafka does not match the ADBPG target table, it can cause write failures. This value represents the number of error rows allowed; if exceeded, the task will fail.', example='5'),
  errorMessage?: string(name='ErrorMessage', description='Service status information, such as the reason for an exception. It is empty in the normal Running state.', example='""'),
  fallbackOffset?: string(name='FallbackOffset', description='Fallback offset, which is the fallback position

- The FallbackOffset parameter defines the behavior when the consumer has not requested a specific offset to consume or the requested offset exceeds the current record\\\\"s offset information in the Kafka cluster. You can choose to start consuming from the earliest (newest) or latest (oldest) offset.', example='EARLIEST /  LATEST'),
  groupName?: string(name='GroupName', description='Kafka group name', example='test_group'),
  jobConfig?: string(name='JobConfig', description='Job configuration file.', example='DATABASE: adbpgss_test
USER: adbpgss_test
PASSWORD: adbpgssTest
HOST: gp-xxx-master.gpdb.rds-aliyun-pre.rds.aliyuncs.com
PORT: 5432
KAFKA:
  INPUT:
    SOURCE:
      BROKERS: broker1:9092,broker2:9092,broker3:9092
      TOPIC: testtopic
      FALLBACK_OFFSET: earliest
    KEY:
      COLUMNS:
      - NAME: customer_id
        TYPE: int
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    VALUE:
      COLUMNS:
      - TYPE: integer
        NAME: l_orderkey
      - TYPE: integer
        NAME: l_partkey
      - TYPE: integer
        NAME: l_suppkey
      - TYPE: integer
        NAME: l_linenumber
      - TYPE: decimal
        NAME: l_quantity
      - TYPE: decimal
        NAME: l_extendedprice
      - TYPE: decimal
        NAME: l_discount
      - TYPE: decimal
        NAME: l_tax
      - TYPE: char
        NAME: l_returnflag
      - TYPE: char
        NAME: l_linestatus
      - TYPE: date
        NAME: l_shipdate
      - TYPE: date
        NAME: l_commitdate
      - TYPE: date
        NAME: l_receiptdate
      - TYPE: text
        NAME: l_shipinstruct
      - TYPE: text
        NAME: l_shipmode
      - TYPE: text
        NAME: l_comment
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    ERROR_LIMIT: 10
  OUTPUT:
    SCHEMA: adbpgss_test
    TABLE: write_with_insert_plaintext
    MODE: MERGE
    MATCH_COLUMNS:
    - l_orderkey
    - l_partkey
    - l_suppkey
    UPDATE_COLUMNS:
    - l_linenumber
    - l_quantity
    - l_extendedprice
    - l_discount
    - l_tax
    - l_returnflag
    - l_linestatus
    - l_shipdate
    - l_commitdate
    - l_receiptdate
    - l_shipinstruct
    - l_shipmode
    - l_comment
    MAPPING:
    - EXPRESSION: l_orderkey
      NAME: l_orderkey
    - EXPRESSION: l_partkey
      NAME: l_partkey
    - EXPRESSION: l_suppkey
      NAME: l_suppkey
    - EXPRESSION: l_linenumber
      NAME: l_linenumber
    - EXPRESSION: l_quantity
      NAME: l_quantity
    - EXPRESSION: l_extendedprice
      NAME: l_extendedprice
    - EXPRESSION: l_discount
      NAME: l_discount
    - EXPRESSION: l_tax
      NAME: l_tax
    - EXPRESSION: l_returnflag
      NAME: l_returnflag
    - EXPRESSION: l_linestatus
      NAME: l_linestatus
    - EXPRESSION: l_shipdate
      NAME: l_shipdate
    - EXPRESSION: l_commitdate
      NAME: l_commitdate
    - EXPRESSION: l_receiptdate
      NAME: l_receiptdate
    - EXPRESSION: l_shipinstruct
      NAME: l_shipinstruct
    - EXPRESSION: l_shipmode
      NAME: l_shipmode
    - EXPRESSION: l_comment
      NAME: l_comment
  COMMIT:
    MAX_ROW: 1000
    MINIMAL_INTERVAL: 1000
    CONSISTENCY: ATLEAST
  POLL:
    BATCHSIZE: 1000
    TIMEOUT: 1000
  PROPERTIES:
    group.id: testgroup'),
  jobDescription?: string(name='JobDescription', description='Job description.', example='test_job'),
  jobId?: string(name='JobId', description='Job ID.', example='1'),
  jobName?: string(name='JobName', description='Job name.', example='test-job'),
  matchColumns?: [ string ](name='MatchColumns', description='Match columns, usually all primary key columns of the target table. If all column values in this configuration are the same, the two rows of data are considered duplicates.'),
  mode?: string(name='Mode', description='Configuration mode
1. Basic mode requires specifying some configuration fields
1. Professional mode supports submitting YAML files', example='basic/professional'),
  modifyTime?: string(name='ModifyTime', description='Last modified time.

Use the UTC time format: yyyy-MM-ddTHH:mm:ssZ', example='2019-09-08T17:00:00Z'),
  password?: string(name='Password', description='Target database password.', example='pwd123'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  srcColumns?: [ string ](name='SrcColumns', description='Source field list.'),
  status?: string(name='Status', description='Service status, with possible values:

- Init: Initializing

- Running: Running

- Exception: Exception

- Paused: Paused', example='Running'),
  updateColumns?: [ string ](name='UpdateColumns', description='Update columns, usually all non-primary key columns of the target table. When data duplication is determined through MatchColumns, updating the UpdateColumns column values will result in new data overwriting old data.'),
  writeMode?: string(name='WriteMode', description='Write mode.', example='INSERT/UPDATE/MERGE'),
}

model DescribeStreamingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeStreamingJobResponseBody(name='body'),
}

/**
 * @summary Delete External Data Source Configuration
 *
 * @param request DescribeStreamingJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeStreamingJobResponse
 */
async function describeStreamingJobWithOptions(request: DescribeStreamingJobRequest, runtime: Util.RuntimeOptions): DescribeStreamingJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeStreamingJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Delete External Data Source Configuration
 *
 * @param request DescribeStreamingJobRequest
 * @return DescribeStreamingJobResponse
 */
async function describeStreamingJob(request: DescribeStreamingJobRequest): DescribeStreamingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeStreamingJobWithOptions(request, runtime);
}

model DescribeSupportFeaturesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model DescribeSupportFeaturesResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='63E5BE60-91FF-57F1-B873-7F1EB734B93D_2724'),
  supportFeatureList?: string(name='SupportFeatureList', description='The features supported by the instance. Valid values:

*   sample_data: sample dataset. For more information, see [Sample dataset](https://help.aliyun.com/document_detail/452278.html).
*   diagnose_and_optimize: diagnostics and optimization. For more information, see [Diagnostics and optimization](https://help.aliyun.com/document_detail/323453.html).', example='[ "sample_data", "diagnose_and_optimize" ]'),
}

model DescribeSupportFeaturesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSupportFeaturesResponseBody(name='body'),
}

/**
 * @summary Queries the features that are supported by an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeSupportFeaturesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSupportFeaturesResponse
 */
async function describeSupportFeaturesWithOptions(request: DescribeSupportFeaturesRequest, runtime: Util.RuntimeOptions): DescribeSupportFeaturesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSupportFeatures',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the features that are supported by an AnalyticDB for PostgreSQL instance.
 *
 * @param request DescribeSupportFeaturesRequest
 * @return DescribeSupportFeaturesResponse
 */
async function describeSupportFeatures(request: DescribeSupportFeaturesRequest): DescribeSupportFeaturesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSupportFeaturesWithOptions(request, runtime);
}

model DescribeTableRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  schema?: string(name='Schema', description='The name of the schema to which the table belongs.

This parameter is required.', example='public'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the DescribeTable operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  table?: string(name='Table', description='The name of the table.

This parameter is required.', example='mytable'),
  workspaceId?: string(name='WorkspaceId'),
}

model DescribeTableResponseBody = {
  columnList?: {
    columnList?: [
    ColumnMetadata
  ](name='ColumnList')
  }(name='ColumnList', description='The columns of the table.'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model DescribeTableResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTableResponseBody(name='body'),
}

/**
 * @summary Queries the information about a table.
 *
 * @param request DescribeTableRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTableResponse
 */
async function describeTableWithOptions(request: DescribeTableRequest, runtime: Util.RuntimeOptions): DescribeTableResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.schema)) {
    query['Schema'] = request.schema;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    query['Table'] = request.table;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTable',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a table.
 *
 * @param request DescribeTableRequest
 * @return DescribeTableResponse
 */
async function describeTable(request: DescribeTableRequest): DescribeTableResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTableWithOptions(request, runtime);
}

model DescribeTagsRequest {
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to **instance**.

This parameter is required.', example='instance'),
}

model DescribeTagsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='A29EC547-B392-4340-AA4F-7C0A7B626E74'),
  tags?: [ 
    {
      tagKey?: string(name='TagKey', description='The tag key.', example='user'),
      tagValue?: string(name='TagValue', description='The tag value.', example='test'),
    }
  ](name='Tags', description='The queried tags.'),
}

model DescribeTagsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTagsResponseBody(name='body'),
}

/**
 * @summary Queries a list of tags for AnalyticDB for PostgreSQL instances.
 *
 * @param request DescribeTagsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTagsResponse
 */
async function describeTagsWithOptions(request: DescribeTagsRequest, runtime: Util.RuntimeOptions): DescribeTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTags',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of tags for AnalyticDB for PostgreSQL instances.
 *
 * @param request DescribeTagsRequest
 * @return DescribeTagsResponse
 */
async function describeTags(request: DescribeTagsRequest): DescribeTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTagsWithOptions(request, runtime);
}

model DescribeUserEncryptionKeyListRequest {
  pageNumber?: string(name='PageNumber', description='The number of the page to return. Default value: 1.', example='1'),
  pageSize?: string(name='PageSize', description='The number of KMS keys to return on each page. Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='ap-southeast-1'),
}

model DescribeUserEncryptionKeyListResponseBody = {
  kmsKeys?: [ 
    {
      keyId?: string(name='KeyId', description='The ID of the KMS key.', example='0b8b1825-fd99-418f-875e-e4dec1dd8715'),
    }
  ](name='KmsKeys', description='Details about the KMS keys.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeUserEncryptionKeyListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserEncryptionKeyListResponseBody(name='body'),
}

/**
 * @summary Queries a list of Key Management Service (KMS) keys.
 *
 * @param request DescribeUserEncryptionKeyListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserEncryptionKeyListResponse
 */
async function describeUserEncryptionKeyListWithOptions(request: DescribeUserEncryptionKeyListRequest, runtime: Util.RuntimeOptions): DescribeUserEncryptionKeyListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeUserEncryptionKeyList',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of Key Management Service (KMS) keys.
 *
 * @param request DescribeUserEncryptionKeyListRequest
 * @return DescribeUserEncryptionKeyListResponse
 */
async function describeUserEncryptionKeyList(request: DescribeUserEncryptionKeyListRequest): DescribeUserEncryptionKeyListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeUserEncryptionKeyListWithOptions(request, runtime);
}

model DescribeWaitingSQLInfoRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='test'),
  PID?: string(name='PID', description='The ID of the process that uniquely identifies the query.

>  You can call the [DescribeWaitingSQLRecords](https://help.aliyun.com/document_detail/461735.html) operation to obtain the process IDs of lock-waiting queries.

This parameter is required.', example='100'),
}

model DescribeWaitingSQLInfoResponseBody = {
  database?: string(name='Database', description='The name of the database.', example='test'),
  items?: [ 
    {
      application?: string(name='Application', description='The application that sent the query.', example='DataGrip 2022.1.5'),
      blockedByApplication?: string(name='BlockedByApplication', description='The application that sent the blocking query.', example='DataGrip 2022.1.5'),
      blockedByPID?: string(name='BlockedByPID', description='The process ID of the blocking query.', example='110'),
      blockedBySQLStmt?: string(name='BlockedBySQLStmt', description='The SQL statement of the blocking query.', example='Select * from t1;'),
      blockedByUser?: string(name='BlockedByUser', description='The database account that is used to perform the blocking query.', example='testUser1'),
      grantLocks?: string(name='GrantLocks', description='The authorized locks.', example='ShareLock,AccessExclusiveLock'),
      notGrantLocks?: string(name='NotGrantLocks', description='The unauthorized locks.', example='AccessShareLock'),
      PID?: string(name='PID', description='The ID of the process that uniquely identifies the query.', example='100'),
      SQLStmt?: string(name='SQLStmt', description='The SQL statement of the query.', example='Select * from t1,t2 where t1.id=t2.id;'),
      user?: string(name='User', description='The database account that is used to perform the query.', example='testUser'),
    }
  ](name='Items', description='The queried lock-waiting query.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DescribeWaitingSQLInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeWaitingSQLInfoResponseBody(name='body'),
}

/**
 * @summary Queries the information about a lock-waiting query for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of a lock-waiting query only for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeWaitingSQLInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeWaitingSQLInfoResponse
 */
async function describeWaitingSQLInfoWithOptions(request: DescribeWaitingSQLInfoRequest, runtime: Util.RuntimeOptions): DescribeWaitingSQLInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.PID)) {
    query['PID'] = request.PID;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeWaitingSQLInfo',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a lock-waiting query for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the details of a lock-waiting query only for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeWaitingSQLInfoRequest
 * @return DescribeWaitingSQLInfoResponse
 */
async function describeWaitingSQLInfo(request: DescribeWaitingSQLInfoRequest): DescribeWaitingSQLInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeWaitingSQLInfoWithOptions(request, runtime);
}

model DescribeWaitingSQLRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='test'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC. The end time must be later than the start time.

If this parameter is not specified, all lock diagnostics records that are generated after the query start time are returned. If the query start time is not specified either, all lock diagnostics records are returned.', example='2022-08-20T07:59Z'),
  keyword?: string(name='Keyword', description='The keyword used to filter queries.', example='table'),
  order?: string(name='Order', description='The field used to sort lock diagnostics records and the sorting order.

Default value: `{"Field":"StartTime","Type":"Desc"}`, which indicates that lock diagnostics records are sorted by the start time in descending order. No other values are supported.', example='{"Field":"StartTime","Type":"Desc"}'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. The value must be an integer that is greater than 0. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  queryCondition?: string(name='QueryCondition', description='The filter condition on queries. Valid values:

*   `{"Type":"maxCost","Value":"10"}`: filters the top 10 longest-waiting queries.
*   `{"Type":"status","Value":"LockWaiting"}`: filters lock-waiting queries.
*   `{"Type":"status","Value":"ResourceWaiting"}`: filters resource-waiting queries.

This parameter is required.', example='{"Type":"maxCost","Value":"10"}'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.

If this parameter is not specified, all lock diagnostics records that are generated before the query end time are returned. If the query end time is not specified either, all lock diagnostics records are returned.', example='2022-08-15T06:59Z'),
  user?: string(name='User', description='The name of the database account. If this parameter is not specified, the lock diagnostics records of all database accounts are queried.', example='testUser'),
}

model DescribeWaitingSQLRecordsResponseBody = {
  items?: [ 
    {
      database?: string(name='Database', description='The name of the database.', example='test'),
      PID?: string(name='PID', description='The ID of the process that uniquely identifies the query.', example='100'),
      SQLStmt?: string(name='SQLStmt', description='The SQL statement of the query.', example='Select * from t1,t2 where t1.id=t2.id;'),
      sessionID?: string(name='SessionID', description='The ID of the session that contains the query.', example='50'),
      startTime?: long(name='StartTime', description='The start time of the query. This value is in the timestamp format. Unit: milliseconds.', example='1660902033374'),
      status?: string(name='Status', description='The waiting state of the query. Valid values:

*   **LockWaiting**
*   **ResourceWaiting**', example='LockWaiting'),
      user?: string(name='User', description='The database account that is used to perform the query.', example='testUser'),
      waitingTime?: long(name='WaitingTime', description='The waiting period of the query. Unit: milliseconds.', example='26911000'),
    }
  ](name='Items', description='The list of lock diagnostics records.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeWaitingSQLRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeWaitingSQLRecordsResponseBody(name='body'),
}

/**
 * @summary Queries the lock diagnostic records of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the lock diagnostics records only for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeWaitingSQLRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeWaitingSQLRecordsResponse
 */
async function describeWaitingSQLRecordsWithOptions(request: DescribeWaitingSQLRecordsRequest, runtime: Util.RuntimeOptions): DescribeWaitingSQLRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.keyword)) {
    query['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryCondition)) {
    query['QueryCondition'] = request.queryCondition;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeWaitingSQLRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the lock diagnostic records of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to query the lock diagnostics records only for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DescribeWaitingSQLRecordsRequest
 * @return DescribeWaitingSQLRecordsResponse
 */
async function describeWaitingSQLRecords(request: DescribeWaitingSQLRecordsRequest): DescribeWaitingSQLRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeWaitingSQLRecordsWithOptions(request, runtime);
}

model DisableDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model DisableDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='53EA07B7-FC2A-521B-AB7C-27**********'),
}

model DisableDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Disables resource group management for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode. After you disable resource group management, the resource management method of the instance switches from resource group management to resource queue management.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL V6.0 instances in elastic storage mode whose minor version is V6.6.1.0 or later.
 * *   You can call this operation to disable resource group management only for AnalyticDB for PostgreSQL instances that are in the **Running** state.
 * *   **Note: When the resource management method is switched, your AnalyticDB for PostgreSQL instance restarts and becomes unavailable for approximately 5 minutes. To prevent your business from being affected, call this operation during off-peak hours.
 *
 * @param request DisableDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableDBResourceGroupResponse
 */
async function disableDBResourceGroupWithOptions(request: DisableDBResourceGroupRequest, runtime: Util.RuntimeOptions): DisableDBResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Disables resource group management for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode. After you disable resource group management, the resource management method of the instance switches from resource group management to resource queue management.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL V6.0 instances in elastic storage mode whose minor version is V6.6.1.0 or later.
 * *   You can call this operation to disable resource group management only for AnalyticDB for PostgreSQL instances that are in the **Running** state.
 * *   **Note: When the resource management method is switched, your AnalyticDB for PostgreSQL instance restarts and becomes unavailable for approximately 5 minutes. To prevent your business from being affected, call this operation during off-peak hours.
 *
 * @param request DisableDBResourceGroupRequest
 * @return DisableDBResourceGroupResponse
 */
async function disableDBResourceGroup(request: DisableDBResourceGroupRequest): DisableDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableDBResourceGroupWithOptions(request, runtime);
}

model DownloadDiagnosisRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-05-07T07:59Z'),
  lang?: string(name='Lang', description='The language of the file that contains the query diagnostic information. Valid values:

*   **zh**: simplified Chinese
*   **en**: English
*   **ja**: Japanese
*   **zh-tw**: traditional Chinese', example='zh'),
  queryCondition?: string(name='QueryCondition', description='The filter condition on queries. The value is in the JSON format. Valid values:

*   `{"Type":"maxCost", "Value":"100"}`: filters the top 100 queries that are the most time-consuming.
*   `{"Type":"status","Value":"finished"}`: filters completed queries.
*   `{"Type":"status","Value":"running"}`: filters running queries.
*   `{"Type":"cost","Max":"200"}`: filters the queries that consume less than 200 milliseconds.
*   `{"Type":"cost","Min":"200","Max":"60000"}`: filters the queries that consume 200 milliseconds or more and less than 1 minute.
*   `{"Type":"cost","Min":"60000"}`: filters the queries that consume 1 minute or more.
*   `{"Type":"cost","Min":"30","Max":"50"}`: filters the queries that consume 30 milliseconds or more and less than 50 milliseconds. You can customize a filter condition by setting **Min** and **Max**.', example='{ "Type":"maxCost", "Value":"100" }'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For more information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the *yyyy-MM-dd*T*HH:mm*Z format. The time must be in UTC.', example='2022-05-07T06:59Z'),
  user?: string(name='User', description='The name of the database account.', example='adbpguser'),
}

model DownloadDiagnosisRecordsResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  downloadId?: string(name='DownloadId', description='The ID of the download task.', example='11'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model DownloadDiagnosisRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DownloadDiagnosisRecordsResponseBody(name='body'),
}

/**
 * @summary Downloads the query diagnostic information of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to download the query diagnostic information of an AnalyticDB for PostgreSQL instance. After the download is complete, you can call the [DescribeDownloadRecords](https://help.aliyun.com/document_detail/447712.html) operation to query download records and download URLs.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DownloadDiagnosisRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DownloadDiagnosisRecordsResponse
 */
async function downloadDiagnosisRecordsWithOptions(request: DownloadDiagnosisRecordsRequest, runtime: Util.RuntimeOptions): DownloadDiagnosisRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.queryCondition)) {
    query['QueryCondition'] = request.queryCondition;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DownloadDiagnosisRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Downloads the query diagnostic information of an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to download the query diagnostic information of an AnalyticDB for PostgreSQL instance. After the download is complete, you can call the [DescribeDownloadRecords](https://help.aliyun.com/document_detail/447712.html) operation to query download records and download URLs.
 * This operation is available only for instances of V6.3.10.1 or later in elastic storage mode. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DownloadDiagnosisRecordsRequest
 * @return DownloadDiagnosisRecordsResponse
 */
async function downloadDiagnosisRecords(request: DownloadDiagnosisRecordsRequest): DownloadDiagnosisRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadDiagnosisRecordsWithOptions(request, runtime);
}

model DownloadSQLLogsRecordsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  database?: string(name='Database', description='The name of the database.', example='testdb'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The end time must be later than the start time.

This parameter is required.', example='2023-05-08T06:59Z'),
  executeCost?: string(name='ExecuteCost', description='The execution duration of the SQL statement. Unit: seconds.', example='1'),
  executeState?: string(name='ExecuteState', description='The execution status of the SQL statement.

*   **1**: successful.
*   **0**: failed.', example='1'),
  lang?: string(name='Lang', description='The language of the file that contains the query diagnostic information. Valid values:

*   **zh**: simplified Chinese.
*   **en**: English.
*   **ja**: Japanese.
*   **zh-tw**: traditional Chinese.', example='zh'),
  maxExecuteCost?: string(name='MaxExecuteCost', description='The maximum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='999'),
  minExecuteCost?: string(name='MinExecuteCost', description='The minimum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.', example='1'),
  operationClass?: string(name='OperationClass', description='The type of the query language. Example: DQL, DML, or DDL.', example='DQL'),
  operationType?: string(name='OperationType', description='The type of the SQL statement. Example: SELECT.', example='SELECT'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  queryKeywords?: string(name='QueryKeywords', description='The keywords that are used for query.', example='select 1'),
  sourceIP?: string(name='SourceIP', description='The source IP address.', example='100.XX.XX.90'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

This parameter is required.', example='2023-05-07T06:59Z'),
  user?: string(name='User', description='The name of the database account.', example='testuser'),
}

model DownloadSQLLogsRecordsResponseBody = {
  downloadId?: long(name='DownloadId', description='The ID of the download task.', example='11'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396F2CAD1'),
}

model DownloadSQLLogsRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DownloadSQLLogsRecordsResponseBody(name='body'),
}

/**
 * @summary Download the slow query logs of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DownloadSQLLogsRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DownloadSQLLogsRecordsResponse
 */
async function downloadSQLLogsRecordsWithOptions(request: DownloadSQLLogsRecordsRequest, runtime: Util.RuntimeOptions): DownloadSQLLogsRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executeCost)) {
    query['ExecuteCost'] = request.executeCost;
  }
  if (!Util.isUnset(request.executeState)) {
    query['ExecuteState'] = request.executeState;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.maxExecuteCost)) {
    query['MaxExecuteCost'] = request.maxExecuteCost;
  }
  if (!Util.isUnset(request.minExecuteCost)) {
    query['MinExecuteCost'] = request.minExecuteCost;
  }
  if (!Util.isUnset(request.operationClass)) {
    query['OperationClass'] = request.operationClass;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryKeywords)) {
    query['QueryKeywords'] = request.queryKeywords;
  }
  if (!Util.isUnset(request.sourceIP)) {
    query['SourceIP'] = request.sourceIP;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.user)) {
    query['User'] = request.user;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DownloadSQLLogsRecords',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Download the slow query logs of an AnalyticDB for PostgreSQL instance.
 *
 * @param request DownloadSQLLogsRecordsRequest
 * @return DownloadSQLLogsRecordsResponse
 */
async function downloadSQLLogsRecords(request: DownloadSQLLogsRecordsRequest): DownloadSQLLogsRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadSQLLogsRecordsWithOptions(request, runtime);
}

model EnableDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model EnableDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='5850BF81-1A2B-5ACE-AF41-57**********'),
}

model EnableDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Enables resource group management for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode. After resource group management is enabled, the resource management mode of the instance is changed from resource queue to resource group.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL V6.0 instances in elastic storage mode whose minor version is V6.6.1.0 or later.
 * *   You can call this operation to enable resource group management only for AnalyticDB for PostgreSQL instances that are in the **Running** state.
 * *   **Note: When the resource management mode is changed, your AnalyticDB for PostgreSQL instance is restarted and remains unavailable within 5 minutes. To prevent your business from being affected, call this operation during off-peak hours.
 *
 * @param request EnableDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableDBResourceGroupResponse
 */
async function enableDBResourceGroupWithOptions(request: EnableDBResourceGroupRequest, runtime: Util.RuntimeOptions): EnableDBResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables resource group management for an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode. After resource group management is enabled, the resource management mode of the instance is changed from resource queue to resource group.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL V6.0 instances in elastic storage mode whose minor version is V6.6.1.0 or later.
 * *   You can call this operation to enable resource group management only for AnalyticDB for PostgreSQL instances that are in the **Running** state.
 * *   **Note: When the resource management mode is changed, your AnalyticDB for PostgreSQL instance is restarted and remains unavailable within 5 minutes. To prevent your business from being affected, call this operation during off-peak hours.
 *
 * @param request EnableDBResourceGroupRequest
 * @return EnableDBResourceGroupResponse
 */
async function enableDBResourceGroup(request: EnableDBResourceGroupRequest): EnableDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableDBResourceGroupWithOptions(request, runtime);
}

model ExecuteStatementRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  ownerId?: long(name='OwnerId'),
  parameters?: [ any ](name='Parameters', description='The configuration parameters.'),
  ragWorkspaceCollection?: {
    collection?: string(name='Collection'),
    namespace?: string(name='Namespace'),
  }(name='RagWorkspaceCollection'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  runType?: string(name='RunType', description='The execution type. Valid values:

*   synchronous
*   asynchronous (not supported)', example='synchronous'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the ExecuteStatement operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  sql?: string(name='Sql', description='The SQL statements that you want to execute.', example='select * from table1'),
  sqls?: [ string ](name='Sqls', description='The SQL statements.'),
  statementName?: string(name='StatementName', description='The name of the set of SQL statements that you want to execute. This parameter takes effect when the RunType parameter is set to asynchronous.', example='test'),
  workspaceId?: string(name='WorkspaceId'),
}

model ExecuteStatementShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  ownerId?: long(name='OwnerId'),
  parametersShrink?: string(name='Parameters', description='The configuration parameters.'),
  ragWorkspaceCollectionShrink?: string(name='RagWorkspaceCollection'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  runType?: string(name='RunType', description='The execution type. Valid values:

*   synchronous
*   asynchronous (not supported)', example='synchronous'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the ExecuteStatement operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  sql?: string(name='Sql', description='The SQL statements that you want to execute.', example='select * from table1'),
  sqlsShrink?: string(name='Sqls', description='The SQL statements.'),
  statementName?: string(name='StatementName', description='The name of the set of SQL statements that you want to execute. This parameter takes effect when the RunType parameter is set to asynchronous.', example='test'),
  workspaceId?: string(name='WorkspaceId'),
}

model ExecuteStatementResponseBody = {
  createdAt?: string(name='CreatedAt', description='The time when the SQL statements were created.', example='2023-12-04T10:08:47+0800'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  data?: {
    columnMetadata?: {
      columnMetadata?: [
      ColumnMetadata
    ](name='ColumnMetadata')
    }(name='ColumnMetadata', description='The metadata of the columns.'),
    records?: {
      records?: [{
      record?: [
      Field
    ](name='Record')
    }    ](name='Records')
    }(name='Records', description='The rows of data.'),
    totalNumRows?: long(name='TotalNumRows', description='The total number of entries returned.', example='10'),
  }(name='Data', description='The returned results of the synchronous call.'),
  database?: string(name='Database', description='The name of the database.', example='adbtest'),
  id?: string(name='Id', description='The ID of the job for asynchronously executing the SQL statements.', example='ABB39CC3'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  secretArn?: string(name='SecretArn', description='The ARN of the access credential for the created Data API account.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ExecuteStatementResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExecuteStatementResponseBody(name='body'),
}

/**
 * @summary Executes SQL statements.
 *
 * @param tmpReq ExecuteStatementRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExecuteStatementResponse
 */
async function executeStatementWithOptions(tmpReq: ExecuteStatementRequest, runtime: Util.RuntimeOptions): ExecuteStatementResponse {
  Util.validateModel(tmpReq);
  var request = new ExecuteStatementShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameters)) {
    request.parametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameters, 'Parameters', 'json');
  }
  if (!Util.isUnset(tmpReq.ragWorkspaceCollection)) {
    request.ragWorkspaceCollectionShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ragWorkspaceCollection, 'RagWorkspaceCollection', 'json');
  }
  if (!Util.isUnset(tmpReq.sqls)) {
    request.sqlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sqls, 'Sqls', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.ragWorkspaceCollectionShrink)) {
    query['RagWorkspaceCollection'] = request.ragWorkspaceCollectionShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.runType)) {
    query['RunType'] = request.runType;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.statementName)) {
    query['StatementName'] = request.statementName;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.parametersShrink)) {
    body['Parameters'] = request.parametersShrink;
  }
  if (!Util.isUnset(request.sql)) {
    body['Sql'] = request.sql;
  }
  if (!Util.isUnset(request.sqlsShrink)) {
    body['Sqls'] = request.sqlsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteStatement',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Executes SQL statements.
 *
 * @param request ExecuteStatementRequest
 * @return ExecuteStatementResponse
 */
async function executeStatement(request: ExecuteStatementRequest): ExecuteStatementResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeStatementWithOptions(request, runtime);
}

model GetAccountRequest {
  accountName?: string(name='AccountName', description='The name of the database account.

This parameter is required.', example='testuser'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-xxxxxxxxx'),
}

model GetAccountResponseBody = {
  accountDescription?: string(name='AccountDescription', description='The new description of the database account.

*   The description must start with a letter.
*   The description cannot start with `http://` or `https://`.
*   The description can contain letters, underscores (_), hyphens (-), and digits.
*   The description must be 2 to 256 characters in length.', example='The instance used by this account to log in is DBInstanceId. The name used to log in is AccountName.'),
  accountName?: string(name='AccountName', description='The name of the initial account.

*   The name can contain lowercase letters, digits, and underscores (_).
*   The name must start with a lowercase letter and end with a lowercase letter or a digit.
*   The name cannot start with gp.
*   The name must be 2 to 16 characters in length.', example='testaccount'),
  accountStatus?: string(name='AccountStatus', description='The status of the member that you want to query.

*   **enabled**: managed.
*   **disabled**: not managed.
*   **disabling**: being deleted.', example='1'),
  accountType?: string(name='AccountType', description='*   Normal: standard account
*   Super: privileged account', example='Normal'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  requestId?: string(name='RequestId', description='Id of the request', example='CA7E4276-E2D5-5F8D-AF06-9EAB3F6C****'),
}

model GetAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountResponseBody(name='body'),
}

/**
 * @summary 获取特定的账号信息
 *
 * @param request GetAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountResponse
 */
async function getAccountWithOptions(request: GetAccountRequest, runtime: Util.RuntimeOptions): GetAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAccount',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取特定的账号信息
 *
 * @param request GetAccountRequest
 * @return GetAccountResponse
 */
async function getAccount(request: GetAccountRequest): GetAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAccountWithOptions(request, runtime);
}

model GetSecretValueRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.

>  You must specify one of the SecretArn and SecretName parameters.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  secretName?: string(name='SecretName', description='The name of the access credential.

>  You must specify one of the SecretArn and SecretName parameters.', example='testsecret'),
  workspaceId?: string(name='WorkspaceId'),
}

model GetSecretValueResponseBody = {
  code?: string(name='Code', description='The error code.', example='Secret.NotFound'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  description?: string(name='Description', description='The description of the access credential.', example='test secret'),
  message?: string(name='Message', description='The returned message.', example='success'),
  password?: string(name='Password', description='The password of the database account.', example='pwd123'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  secretArn?: string(name='SecretArn', description='The ARN of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  secretName?: string(name='SecretName', description='The name of the access credential.', example='testsecret'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
  username?: string(name='Username', description='The name of the database account.', example='testacc'),
}

model GetSecretValueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSecretValueResponseBody(name='body'),
}

/**
 * @summary Queries the information about an access credential.
 *
 * @param request GetSecretValueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSecretValueResponse
 */
async function getSecretValueWithOptions(request: GetSecretValueRequest, runtime: Util.RuntimeOptions): GetSecretValueResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.secretName)) {
    query['SecretName'] = request.secretName;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSecretValue',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about an access credential.
 *
 * @param request GetSecretValueRequest
 * @return GetSecretValueResponse
 */
async function getSecretValue(request: GetSecretValueRequest): GetSecretValueResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSecretValueWithOptions(request, runtime);
}

model GetStatementResultRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID. Can be obtained by calling DescribeDBInstances.

This parameter is required.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='Database name.', example='test'),
  id?: string(name='Id', description='Task ID for asynchronous SQL execution.

This parameter is required.', example='9A920F47-416A-4044-817C-7C2A72AD16D3'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-beijing'),
  secretArn?: string(name='SecretArn', description='Access credential. Created through the CreateSecret interface.

> When accessing this interface with a sub-account, the sub-account must have the UseSecret or GetSecretValue permission for this SecretArn.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
}

model GetStatementResultResponseBody = {
  data?: {
    columnMetadata?: {
      columnMetadata?: [
      ColumnMetadata
    ](name='ColumnMetadata')
    }(name='ColumnMetadata', description='List of column metadata.'),
    records?: {
      records?: [{
      record?: [
      Field
    ](name='Record')
    }    ](name='Records')
    }(name='Records', description='Multiple rows of data.'),
    totalNumRows?: long(name='TotalNumRows', description='Total number of entries.', example='10'),
  }(name='Data', description='The result of the asynchronous call.'),
  message?: string(name='Message', description='Return message.', example='success'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='API execution status, with values as follows:

- **false**: Execution failed.
- **true**: Execution succeeded.', example='success'),
}

model GetStatementResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetStatementResultResponseBody(name='body'),
}

/**
 * @summary Get Asynchronous SQL Execution Result
 *
 * @param request GetStatementResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetStatementResultResponse
 */
async function getStatementResultWithOptions(request: GetStatementResultRequest, runtime: Util.RuntimeOptions): GetStatementResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetStatementResult',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get Asynchronous SQL Execution Result
 *
 * @param request GetStatementResultRequest
 * @return GetStatementResultResponse
 */
async function getStatementResult(request: GetStatementResultRequest): GetStatementResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getStatementResultWithOptions(request, runtime);
}

model GetUploadDocumentJobRequest {
  collection?: string(name='Collection', description='The name of the document collection.

>  You can call the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) operation to create a document collection and call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) operation to query a list of document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance for which vector engine optimization is enabled.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='The ID of the document upload job. You can call the `UploadDocumentAsync` operation to query the job ID.

This parameter is required.', example='bf8f7bc4-9276-44f7-9c22-1d06edc8dfd1'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model GetUploadDocumentJobResponseBody = {
  chunkResult?: {
    chunkFileUrl?: string(name='ChunkFileUrl', description='The URL of the file after chunking. The validity period of the URL is 2 hours. The file is in the JSONL format. Each line is in the `{"page_content":"*****", "metadata": {"**":"***","**":"***"}` format.', example='http://xxx/test.jsonl'),
    plainChunkFileUrl?: string(name='PlainChunkFileUrl', description='The URL of the file that does not contain metadata after chunking. The validity period of the URL is 2 hours. The file is in the TXT format. Each line is a chunk. The file can be easily used for embedding.', example='http://xxx/test.txt'),
  }(name='ChunkResult', description='The chunking result.'),
  job?: {
    completed?: boolean(name='Completed', description='Indicates whether the operation is complete.', example='false'),
    createTime?: string(name='CreateTime', description='The time when the job was created.', example='2024-01-08 16:52:04.864664'),
    error?: string(name='Error', description='The error message.', example='Failed to connect database.'),
    errorCode?: string(name='ErrorCode', description='The error code.', example='InternalError'),
    id?: string(name='Id', description='The job ID.', example='231460f8-75dc-405e-a669-0c5204887e91'),
    progress?: int32(name='Progress', description='The progress of the document upload job. Unit: %. A value of 100 indicates that the job is complete.', example='20'),
    status?: string(name='Status', description='The status of the job. Valid values: Valid values:

*   Success
*   Failed (See the Error parameter for failure reasons.)
*   Cancelling
*   Cancelled
*   Start
*   Running
*   Pending', example='Running'),
    updateTime?: string(name='UpdateTime', description='The time when the job was updated.', example='2024-01-08 16:53:04.864664'),
  }(name='Job', description='The information about the document upload job.'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
  usage?: {
    embeddingEntries?: int32(name='EmbeddingEntries', description='The count of embedding entries.', example='10'),
    embeddingTokens?: int32(name='EmbeddingTokens', description='The number of tokens that are used for vectorization.

>  A token is the minimum unit for splitting text. A token can be a word, phrase, punctuation, or character.', example='475'),
  }(name='Usage', description='The number of tokens that are used for document understanding or embedding.'),
}

model GetUploadDocumentJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetUploadDocumentJobResponseBody(name='body'),
}

/**
 * @summary Queries the progress and result of an asynchronous document upload job based on the job ID.
 *
 * @description This operation is related to the UploadDocumentAsync operation. You can call the UploadDocumentAsync operation to create an upload job and obtain the job ID, and then call the GetUploadDocumentJob operation to query the execution information of the job.
 * >  Suggestions:
 * *   Determine whether the document upload job times out based on the document complexity and the number of tokens after chunking. In most cases, a job that lasts more than 2 hours is considered timeout.
 *
 * @param request GetUploadDocumentJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetUploadDocumentJobResponse
 */
async function getUploadDocumentJobWithOptions(request: GetUploadDocumentJobRequest, runtime: Util.RuntimeOptions): GetUploadDocumentJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUploadDocumentJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the progress and result of an asynchronous document upload job based on the job ID.
 *
 * @description This operation is related to the UploadDocumentAsync operation. You can call the UploadDocumentAsync operation to create an upload job and obtain the job ID, and then call the GetUploadDocumentJob operation to query the execution information of the job.
 * >  Suggestions:
 * *   Determine whether the document upload job times out based on the document complexity and the number of tokens after chunking. In most cases, a job that lasts more than 2 hours is considered timeout.
 *
 * @param request GetUploadDocumentJobRequest
 * @return GetUploadDocumentJobResponse
 */
async function getUploadDocumentJob(request: GetUploadDocumentJobRequest): GetUploadDocumentJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUploadDocumentJobWithOptions(request, runtime);
}

model GetUpsertCollectionDataJobRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  jobId?: string(name='JobId', description='The ID of the vector data upload job. You can call the `UpsertCollectionDataAsync` operation to query the job ID.

This parameter is required.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model GetUpsertCollectionDataJobResponseBody = {
  job?: {
    completed?: boolean(name='Completed', description='Indicates whether the operation is complete.', example='false'),
    createTime?: string(name='CreateTime', description='The time when the job was created.', example='2024-01-08 16:52:04.864664'),
    error?: string(name='Error', description='The error message.', example='Failed to connect database.'),
    id?: string(name='Id', description='The job ID.', example='231460f8-75dc-405e-a669-0c5204887e91'),
    progress?: int32(name='Progress', description='The progress of the vector data upload job. The value of this parameter indicates the number of data entries that have been uploaded.', example='1600'),
    status?: string(name='Status', description='The status of the job.

>  Valid values:

*   Success

*   Failed (See the Error parameter for failure reasons.)

*   Cancelling

*   Cancelled

*   Start

*   Running', example='Success'),
    updateTime?: string(name='UpdateTime', description='The time when the job was updated.', example='2024-01-08 16:53:04.864664'),
  }(name='Job', description='The information about the vector data upload job.'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model GetUpsertCollectionDataJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetUpsertCollectionDataJobResponseBody(name='body'),
}

/**
 * @summary Queries the progress and result of an asynchronous vector data upload job by using a job ID.
 *
 * @description This operation is related to the `UpsertCollectionDataAsync` operation. You can call the `UpsertCollectionDataAsync` operation to create an upload job and obtain a job ID, and then call the GetUpsertCollectionDataJob operation to query the execution information of the job.
 * >  We recommend that you evaluate the amount of time required for the upload job based on 1,000 data entries every second, and then query the job progress every 5 seconds. The timeout period can be set to 30 minutes after the evaluated amount of time.
 *
 * @param request GetUpsertCollectionDataJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetUpsertCollectionDataJobResponse
 */
async function getUpsertCollectionDataJobWithOptions(request: GetUpsertCollectionDataJobRequest, runtime: Util.RuntimeOptions): GetUpsertCollectionDataJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUpsertCollectionDataJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the progress and result of an asynchronous vector data upload job by using a job ID.
 *
 * @description This operation is related to the `UpsertCollectionDataAsync` operation. You can call the `UpsertCollectionDataAsync` operation to create an upload job and obtain a job ID, and then call the GetUpsertCollectionDataJob operation to query the execution information of the job.
 * >  We recommend that you evaluate the amount of time required for the upload job based on 1,000 data entries every second, and then query the job progress every 5 seconds. The timeout period can be set to 30 minutes after the evaluated amount of time.
 *
 * @param request GetUpsertCollectionDataJobRequest
 * @return GetUpsertCollectionDataJobResponse
 */
async function getUpsertCollectionDataJob(request: GetUpsertCollectionDataJobRequest): GetUpsertCollectionDataJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUpsertCollectionDataJobWithOptions(request, runtime);
}

model GrantCollectionRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [CreateCollection](https://help.aliyun.com/document_detail/2401497.html) operation to create a vector collection and call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of vector collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance in reserved storage mode.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  grantToNamespace?: string(name='GrantToNamespace', description='The name of the namespace to which you want to grant the vector collection permissions.

This parameter is required.', example='othernamespace'),
  grantType?: string(name='GrantType', description='The type of the permissions that you want to grant. Valid values:

*   rw: the read and write permissions.
*   ro: the read-only permission.
*   none: the delete permission.

This parameter is required.', example='rw'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  namespace?: string(name='Namespace', description='The name of the namespace.

>  You can call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model GrantCollectionResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model GrantCollectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GrantCollectionResponseBody(name='body'),
}

/**
 * @summary Grants vector collection permissions to a namespace.
 *
 * @param request GrantCollectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GrantCollectionResponse
 */
async function grantCollectionWithOptions(request: GrantCollectionRequest, runtime: Util.RuntimeOptions): GrantCollectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.grantToNamespace)) {
    query['GrantToNamespace'] = request.grantToNamespace;
  }
  if (!Util.isUnset(request.grantType)) {
    query['GrantType'] = request.grantType;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GrantCollection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Grants vector collection permissions to a namespace.
 *
 * @param request GrantCollectionRequest
 * @return GrantCollectionResponse
 */
async function grantCollection(request: GrantCollectionRequest): GrantCollectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return grantCollectionWithOptions(request, runtime);
}

model HandleActiveSQLRecordRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp***************'),
  operateType?: int32(name='OperateType', description='The type of the operation on the process ID. Valid values:

*   **0**: cancel.
*   **1**: terminate.
*   **2**: forcefully terminate.', example='0'),
  pids?: string(name='Pids', description='The process IDs. A process ID is a unique identifier of a query.

This parameter is required.', example='"3003925,3003928"'),
}

model HandleActiveSQLRecordResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp***************'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  results?: [ 
    {
      pid?: string(name='Pid', description='The process ID, which is a unique identifier of the query.', example='3003925'),
      status?: string(name='Status', description='Indicates whether the processing was successful. Valid values:

*   **false**
*   **true**', example='true'),
    }
  ](name='Results', description='The processing result of the active query.'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **false**
*   **true**', example='true'),
}

model HandleActiveSQLRecordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: HandleActiveSQLRecordResponseBody(name='body'),
}

/**
 * @summary Processes active queries.
 *
 * @param request HandleActiveSQLRecordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return HandleActiveSQLRecordResponse
 */
async function handleActiveSQLRecordWithOptions(request: HandleActiveSQLRecordRequest, runtime: Util.RuntimeOptions): HandleActiveSQLRecordResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.operateType)) {
    query['OperateType'] = request.operateType;
  }
  if (!Util.isUnset(request.pids)) {
    query['Pids'] = request.pids;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'HandleActiveSQLRecord',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Processes active queries.
 *
 * @param request HandleActiveSQLRecordRequest
 * @return HandleActiveSQLRecordResponse
 */
async function handleActiveSQLRecord(request: HandleActiveSQLRecordRequest): HandleActiveSQLRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  return handleActiveSQLRecordWithOptions(request, runtime);
}

model InitVectorDatabaseRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the database account.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model InitVectorDatabaseResponseBody = {
  message?: string(name='Message', description='The error message returned if the request fails.', example='failed to connect database, detailMsg: getConnection fail::SQL State: 28P01, Error Code: 0, Error Message: FATAL: password'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **Success**
*   **fail**', example='success'),
}

model InitVectorDatabaseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InitVectorDatabaseResponseBody(name='body'),
}

/**
 * @summary Initializes vector databases.
 *
 * @param request InitVectorDatabaseRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InitVectorDatabaseResponse
 */
async function initVectorDatabaseWithOptions(request: InitVectorDatabaseRequest, runtime: Util.RuntimeOptions): InitVectorDatabaseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InitVectorDatabase',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Initializes vector databases.
 *
 * @param request InitVectorDatabaseRequest
 * @return InitVectorDatabaseResponse
 */
async function initVectorDatabase(request: InitVectorDatabaseRequest): InitVectorDatabaseResponse {
  var runtime = new Util.RuntimeOptions{};
  return initVectorDatabaseWithOptions(request, runtime);
}

model ListBackupJobsRequest {
  backupMode?: string(name='BackupMode', example='Automated'),
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
}

model ListBackupJobsResponseBody = {
  items?: {
    backupJob?: [ 
    {
      backupJobId?: string(name='BackupJobId', example='123'),
      backupMode?: string(name='BackupMode', example='Automated'),
      backupStatus?: string(name='BackupStatus', example='Success'),
      process?: string(name='Process', example='50%'),
      startTime?: string(name='StartTime', example='2022-08-11T09:26:43Z'),
    }
  ](name='BackupJob')
  }(name='Items'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model ListBackupJobsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListBackupJobsResponseBody(name='body'),
}

/**
 * @summary 获取备份任务列表
 *
 * @param request ListBackupJobsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListBackupJobsResponse
 */
async function listBackupJobsWithOptions(request: ListBackupJobsRequest, runtime: Util.RuntimeOptions): ListBackupJobsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupMode)) {
    query['BackupMode'] = request.backupMode;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListBackupJobs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取备份任务列表
 *
 * @param request ListBackupJobsRequest
 * @return ListBackupJobsResponse
 */
async function listBackupJobs(request: ListBackupJobsRequest): ListBackupJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listBackupJobsWithOptions(request, runtime);
}

model ListCollectionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model ListCollectionsResponseBody = {
  collections?: {
    collection?: [ string ](name='Collection')
  }(name='Collections', description='The queried vector collections.'),
  count?: int32(name='Count', description='The total number of entries returned.', example='1'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  namespace?: string(name='Namespace', description='The name of the namespace.', example='mynamespace'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListCollectionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCollectionsResponseBody(name='body'),
}

/**
 * @summary Queries a list of vector collections.
 *
 * @param request ListCollectionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCollectionsResponse
 */
async function listCollectionsWithOptions(request: ListCollectionsRequest, runtime: Util.RuntimeOptions): ListCollectionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCollections',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of vector collections.
 *
 * @param request ListCollectionsRequest
 * @return ListCollectionsResponse
 */
async function listCollections(request: ListCollectionsRequest): ListCollectionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCollectionsWithOptions(request, runtime);
}

model ListDatabasesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='testdb'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page. Valid values: 1 to 100.', example='50'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the DescribeTable operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
}

model ListDatabasesResponseBody = {
  databases?: {
    databases?: [ string ](name='Databases')
  }(name='Databases', description='The queried databases.'),
  message?: string(name='Message', description='The returned message.', example='success'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListDatabasesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDatabasesResponseBody(name='body'),
}

/**
 * @summary Queries a list of databases.
 *
 * @param request ListDatabasesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDatabasesResponse
 */
async function listDatabasesWithOptions(request: ListDatabasesRequest, runtime: Util.RuntimeOptions): ListDatabasesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDatabases',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of databases.
 *
 * @param request ListDatabasesRequest
 * @return ListDatabasesResponse
 */
async function listDatabases(request: ListDatabasesRequest): ListDatabasesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDatabasesWithOptions(request, runtime);
}

model ListDocumentCollectionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  This value is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model ListDocumentCollectionsResponseBody = {
  count?: int32(name='Count', description='The total number of entries returned.', example='10'),
  items?: {
    collectionList?: [ 
    {
      collectionName?: string(name='CollectionName', description='The name of the document collection.', example='document'),
      dimension?: int32(name='Dimension', description='The number of vector dimensions.', example='1536'),
      embeddingModel?: string(name='EmbeddingModel', description='The name of the vector algorithm.', example='text-embeddding-v1'),
      fullTextRetrievalFields?: string(name='FullTextRetrievalFields', description='The fields that are used for full-text search. Multiple fields are separated by commas (,).', example='title'),
      metadata?: string(name='Metadata', description='The metadata.', example='{\\\\"page\\\\": \\\\"int\\\\", \\\\"title\\\\": \\\\"text\\\\"}'),
      metrics?: string(name='Metrics', description='The vector similarity algorithm.', example='cosine'),
      parser?: string(name='Parser', description='The analyzer that is used for full-text search.', example='zh_cn'),
    }
  ](name='CollectionList')
  }(name='Items', description='The queried document collections.'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListDocumentCollectionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDocumentCollectionsResponseBody(name='body'),
}

/**
 * @summary Queries a list of document collections.
 *
 * @param request ListDocumentCollectionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDocumentCollectionsResponse
 */
async function listDocumentCollectionsWithOptions(request: ListDocumentCollectionsRequest, runtime: Util.RuntimeOptions): ListDocumentCollectionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDocumentCollections',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of document collections.
 *
 * @param request ListDocumentCollectionsRequest
 * @return ListDocumentCollectionsResponse
 */
async function listDocumentCollections(request: ListDocumentCollectionsRequest): ListDocumentCollectionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDocumentCollectionsWithOptions(request, runtime);
}

model ListDocumentsRequest {
  collection?: string(name='Collection', description='The name of the document collection.

>  You can call the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) operation to create a document collection and call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) operation to query a list of document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query details about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page. Valid values: 1 to 100.', example='100'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  This value is specified when you call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation.

This parameter is required.', example='testpassword'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model ListDocumentsResponseBody = {
  count?: int32(name='Count', description='The total number of entries returned.', example='3'),
  items?: {
    documentList?: [ 
    {
      fileName?: string(name='FileName', description='The name of the document.', example='music.txt'),
      source?: string(name='Source', description='The source of the document.', example='http://oss.xxx/music.txt'),
    }
  ](name='DocumentList')
  }(name='Items', description='The queried documents.'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListDocumentsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDocumentsResponseBody(name='body'),
}

/**
 * @summary Queries a list of documents in a collection.
 *
 * @param request ListDocumentsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDocumentsResponse
 */
async function listDocumentsWithOptions(request: ListDocumentsRequest, runtime: Util.RuntimeOptions): ListDocumentsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDocuments',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of documents in a collection.
 *
 * @param request ListDocumentsRequest
 * @return ListDocumentsResponse
 */
async function listDocuments(request: ListDocumentsRequest): ListDocumentsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDocumentsWithOptions(request, runtime);
}

model ListExternalDataServicesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='50'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
}

model ListExternalDataServicesResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceItems?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
      modifyTime?: string(name='ModifyTime', description='The time when the service was last modified.', example='2019-09-08T17:00:00Z'),
      serviceDescription?: string(name='ServiceDescription', description='The description of the service.', example='test-adbpgss'),
      serviceId?: string(name='ServiceId', description='The service ID.', example='1'),
      serviceName?: string(name='ServiceName', description='The name of the service.', example='test-adbpgss'),
      serviceSpec?: string(name='ServiceSpec', description='The specifications of the service. Unit: compute units (CUs).', example='2'),
      serviceType?: string(name='ServiceType', description='The type of the service. Valid values:

*   pxf', example='pxf'),
      status?: string(name='Status', description='The status of the service. Valid values:

*   Init
*   Running
*   Exception
*   Paused', example='Running'),
    }
  ](name='ServiceItems', description='The queried services.'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='2'),
}

model ListExternalDataServicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExternalDataServicesResponseBody(name='body'),
}

/**
 * @summary Queries a list of external data services.
 *
 * @param request ListExternalDataServicesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExternalDataServicesResponse
 */
async function listExternalDataServicesWithOptions(request: ListExternalDataServicesRequest, runtime: Util.RuntimeOptions): ListExternalDataServicesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExternalDataServices',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of external data services.
 *
 * @param request ListExternalDataServicesRequest
 * @return ListExternalDataServicesResponse
 */
async function listExternalDataServices(request: ListExternalDataServicesRequest): ListExternalDataServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listExternalDataServicesWithOptions(request, runtime);
}

model ListExternalDataSourcesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: 30.', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-shanghai'),
}

model ListExternalDataSourcesResponseBody = {
  items?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the service was created.', example='2019-09-08T16:00:00Z'),
      dataSourceDescription?: string(name='DataSourceDescription', description='The description of the data source.', example='test'),
      dataSourceDir?: string(name='DataSourceDir', description='The service directory in which Hadoop-related configuration files are stored.', example='HadoopDir'),
      dataSourceId?: int32(name='DataSourceId', description='The service ID.', example='123'),
      dataSourceName?: string(name='DataSourceName', description='The name of the service.', example='hdfs_pxf'),
      dataSourceStatus?: string(name='DataSourceStatus', description='The status of the service. Valid values:

*   init
*   running
*   exception', example='Running'),
      dataSourceType?: string(name='DataSourceType', description='The type of the data source.', example='HDFS'),
      externalDataServiceId?: int32(name='ExternalDataServiceId', description='The Id of external data service', example='123'),
      modifyTime?: string(name='ModifyTime', description='The time when the service was last modified.', example='2019-10-08T16:00:00Z'),
      statusMessage?: string(name='StatusMessage', description='The information about the service status. For example, if the service is in the exception state, the cause of the exception is displayed. If the service is in the running state, this parameter is left empty.', example='""'),
    }
  ](name='Items', description='The Hadoop external table services.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='BBE00C04-A3E8-4114-881D-0480A72CB92E'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='2'),
}

model ListExternalDataSourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExternalDataSourcesResponseBody(name='body'),
}

/**
 * @summary 获取实例外表配置列表
 *
 * @param request ListExternalDataSourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExternalDataSourcesResponse
 */
async function listExternalDataSourcesWithOptions(request: ListExternalDataSourcesRequest, runtime: Util.RuntimeOptions): ListExternalDataSourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExternalDataSources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取实例外表配置列表
 *
 * @param request ListExternalDataSourcesRequest
 * @return ListExternalDataSourcesResponse
 */
async function listExternalDataSources(request: ListExternalDataSourcesRequest): ListExternalDataSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listExternalDataSourcesWithOptions(request, runtime);
}

model ListIndicesRequest {
  collection?: string(name='Collection', description='This parameter is required.', example='testcollection'),
  DBInstanceId?: string(name='DBInstanceId', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', example='gp-ws-*****'),
}

model ListIndicesResponseBody = {
  indices?: {
    indices?: [ 
    {
      collection?: string(name='Collection', example='testcollection'),
      indexDef?: string(name='IndexDef', example='CREATE INDEX testindex ON mynamespace. testcollection'),
      indexName?: string(name='IndexName', example='testindex'),
      namespace?: string(name='Namespace', example='mynamespace'),
    }
  ](name='Indices')
  }(name='Indices'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', example='success'),
}

model ListIndicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListIndicesResponseBody(name='body'),
}

/**
 * @summary 获取索引列表
 *
 * @param request ListIndicesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListIndicesResponse
 */
async function listIndicesWithOptions(request: ListIndicesRequest, runtime: Util.RuntimeOptions): ListIndicesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListIndices',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取索引列表
 *
 * @param request ListIndicesRequest
 * @return ListIndicesResponse
 */
async function listIndices(request: ListIndicesRequest): ListIndicesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listIndicesWithOptions(request, runtime);
}

model ListInstanceExtensionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  extension?: string(name='Extension', description='The name of the extension.', example='citext'),
  installStatus?: string(name='InstallStatus', description='The installation status of the extension. Valid values:

*   installed
*   installing
*   uninstalled', example='installed'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
}

model ListInstanceExtensionsResponseBody = {
  items?: [ 
    {
      currentVersion?: string(name='CurrentVersion', description='The current version.', example='1.0'),
      description?: string(name='Description', description='The description of the extension.', example='citext usage'),
      extensionId?: string(name='ExtensionId', description='The extension ID.', example='1'),
      installedDatabases?: string(name='InstalledDatabases', description='The names of the databases in which the extension is installed.', example='test'),
      isInstallNeedRestart?: boolean(name='IsInstallNeedRestart', description='Indicates whether an instance restart is required after you install the extension for the extension to take effect.', example='false'),
      latestVersion?: string(name='LatestVersion', description='The latest version.', example='1.1'),
      name?: string(name='Name', description='The name of the extension.', example='citext'),
      status?: string(name='Status', description='The status of the extension.', example='installed'),
    }
  ](name='Items', description='The queried extensions.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='The number of entries per page.', example='20'),
  requestId?: string(name='RequestId', description='The request ID.', example='7565770E-7C45-462D-BA4A-8A5396F2CAD1'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='1'),
}

model ListInstanceExtensionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceExtensionsResponseBody(name='body'),
}

/**
 * @summary Queries a list of extensions.
 *
 * @param request ListInstanceExtensionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceExtensionsResponse
 */
async function listInstanceExtensionsWithOptions(request: ListInstanceExtensionsRequest, runtime: Util.RuntimeOptions): ListInstanceExtensionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.extension)) {
    query['Extension'] = request.extension;
  }
  if (!Util.isUnset(request.installStatus)) {
    query['InstallStatus'] = request.installStatus;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceExtensions',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of extensions.
 *
 * @param request ListInstanceExtensionsRequest
 * @return ListInstanceExtensionsResponse
 */
async function listInstanceExtensions(request: ListInstanceExtensionsRequest): ListInstanceExtensionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstanceExtensionsWithOptions(request, runtime);
}

model ListNamespacesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  managerAccount?: string(name='ManagerAccount', description='The name of the manager account that has the rds_superuser permission.

>  You can create an account on the Account Management page of the AnalyticDB for PostgreSQL console or by calling the [CreateAccount](https://help.aliyun.com/document_detail/2361789.html) operation.

This parameter is required.', example='testaccount'),
  managerAccountPassword?: string(name='ManagerAccountPassword', description='The password of the manager account.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model ListNamespacesResponseBody = {
  count?: int32(name='Count', description='The total number of entries returned.', example='1'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-xxxxxxxxx'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  namespaces?: {
    namespace?: [ string ](name='Namespace')
  }(name='Namespaces', description='The queried namespaces.'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListNamespacesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListNamespacesResponseBody(name='body'),
}

/**
 * @summary Queries a list of namespaces.
 *
 * @param request ListNamespacesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListNamespacesResponse
 */
async function listNamespacesWithOptions(request: ListNamespacesRequest, runtime: Util.RuntimeOptions): ListNamespacesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.managerAccount)) {
    query['ManagerAccount'] = request.managerAccount;
  }
  if (!Util.isUnset(request.managerAccountPassword)) {
    query['ManagerAccountPassword'] = request.managerAccountPassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListNamespaces',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of namespaces.
 *
 * @param request ListNamespacesRequest
 * @return ListNamespacesResponse
 */
async function listNamespaces(request: ListNamespacesRequest): ListNamespacesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listNamespacesWithOptions(request, runtime);
}

model ListRemoteADBDataSourcesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance name.

This parameter is required.', example='gp-xxxx'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.', example='119'),
  ownerId?: long(name='OwnerId'),
}

model ListRemoteADBDataSourcesResponseBody = {
  dataSourceItems?: {
    remoteDataSources?: [ 
    {
      dataSourceName?: string(name='DataSourceName', description='Data source name', example='db1_gptest1_to_db2_gp-test2'),
      description?: string(name='Description', description='Description.', example='test'),
      id?: long(name='Id', description='ID.', example='1'),
      localDatabase?: string(name='LocalDatabase', description='Local database name', example='db1'),
      localInstanceName?: string(name='LocalInstanceName', description='Local instance name', example='gp-test1'),
      managerUserName?: string(name='ManagerUserName', description='Manager user name', example='admin'),
      regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
      remoteDatabase?: string(name='RemoteDatabase', description='Remote database name', example='db2'),
      remoteInstanceName?: string(name='RemoteInstanceName', description='Remote instance name', example='gp-test2'),
      status?: string(name='Status', description='Data source status', example='creating'),
      userName?: string(name='UserName', description='User name', example='user1'),
    }
  ](name='RemoteDataSources')
  }(name='DataSourceItems', description='Returns the successfully added data sharing service data.'),
  requestId?: string(name='RequestId', description='Request ID.', example='e9d60eb1-e90d-4bc6-a470-c8b767460858'),
  taskId?: int32(name='TaskId', description='Task ID.', example='90000'),
}

model ListRemoteADBDataSourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRemoteADBDataSourcesResponseBody(name='body'),
}

/**
 * @summary Get Homogeneous Data Source
 *
 * @param request ListRemoteADBDataSourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRemoteADBDataSourcesResponse
 */
async function listRemoteADBDataSourcesWithOptions(request: ListRemoteADBDataSourcesRequest, runtime: Util.RuntimeOptions): ListRemoteADBDataSourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRemoteADBDataSources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get Homogeneous Data Source
 *
 * @param request ListRemoteADBDataSourcesRequest
 * @return ListRemoteADBDataSourcesResponse
 */
async function listRemoteADBDataSources(request: ListRemoteADBDataSourcesRequest): ListRemoteADBDataSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRemoteADBDataSourcesWithOptions(request, runtime);
}

model ListSchemasRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page. Valid values: 1 to 100.', example='20'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  schemaPattern?: string(name='SchemaPattern', description='The schema name pattern for matching. For example, `ab%` specifies to match schema names that start with ab.', example='aaa%'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the ListSchemas operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
}

model ListSchemasResponseBody = {
  message?: string(name='Message', description='The returned message.', example='success'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  schemas?: {
    schemas?: [ string ](name='Schemas')
  }(name='Schemas', description='The queried schemas.'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListSchemasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSchemasResponseBody(name='body'),
}

/**
 * @summary Queries a list of schemas.
 *
 * @param request ListSchemasRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSchemasResponse
 */
async function listSchemasWithOptions(request: ListSchemasRequest, runtime: Util.RuntimeOptions): ListSchemasResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.schemaPattern)) {
    query['SchemaPattern'] = request.schemaPattern;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSchemas',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of schemas.
 *
 * @param request ListSchemasRequest
 * @return ListSchemasResponse
 */
async function listSchemas(request: ListSchemasRequest): ListSchemasResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSchemasWithOptions(request, runtime);
}

model ListSecretsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  workspaceId?: string(name='WorkspaceId'),
}

model ListSecretsResponseBody = {
  count?: long(name='Count', description='The number of access credentials.', example='4'),
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  secrets?: {
    secrets?: [ 
    {
      accountId?: string(name='AccountId', description='The ID of the Alibaba Cloud account.', example='1033***'),
      DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp14****'),
      description?: string(name='Description', description='The description of the access credential.', example='test description'),
      regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-beijing'),
      secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. Format: `acs:gpdb:{{region}}:{{accountId}}:secret/{{secretName}}-{{32 digits random string}`.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
      secretName?: string(name='SecretName', description='The name of the access credential.', example='testsecret'),
      username?: string(name='Username', description='The name of the database account.', example='testacc'),
    }
  ](name='Secrets')
  }(name='Secrets', description='The queried access credentials.'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model ListSecretsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSecretsResponseBody(name='body'),
}

/**
 * @summary Queries a list of access credentials.
 *
 * @param request ListSecretsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSecretsResponse
 */
async function listSecretsWithOptions(request: ListSecretsRequest, runtime: Util.RuntimeOptions): ListSecretsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSecrets',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of access credentials.
 *
 * @param request ListSecretsRequest
 * @return ListSecretsResponse
 */
async function listSecrets(request: ListSecretsRequest): ListSecretsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSecretsWithOptions(request, runtime);
}

model ListStreamingDataServicesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  pageNumber?: int32(name='PageNumber', description='Page number, greater than 0 and not exceeding the maximum value of Integer, default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='Number of records per page, with the following values:
- 30 (default)
- 50
- 100', example='50'),
  regionId?: string(name='RegionId', description='Region ID', example='cn-beijing'),
}

model ListStreamingDataServicesResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  serviceItems?: [ 
    {
      createTime?: string(name='CreateTime', description='Creation time.', example='2019-09-08T16:00:00Z'),
      modifyTime?: string(name='ModifyTime', description='Last modified time', example='2019-09-08T17:00:00Z'),
      serviceDescription?: string(name='ServiceDescription', description='Service description.', example='test-adbpgss'),
      serviceId?: string(name='ServiceId', description='Service ID.', example='1'),
      serviceIp?: string(name='ServiceIp', description='Service IP.', example='192.168.0.1'),
      serviceManaged?: boolean(name='ServiceManaged', description='Whether it is a managed service.', example='true'),
      serviceName?: string(name='ServiceName', description='Service name.', example='test-adbpgss'),
      serviceOwnerId?: string(name='ServiceOwnerId', description='Service owner ID.', example='123'),
      servicePort?: string(name='ServicePort', description='Service port.', example='5432'),
      serviceSpec?: string(name='ServiceSpec', description='Service specification (in CU).', example='8'),
      serviceType?: string(name='ServiceType', description='Service type, with the following value:

- **adbpgss**', example='adbpgss'),
      status?: string(name='Status', description='Service status, with the following values:

- Init: Initializing

- Running: In operation

- Exception: Abnormal

- Paused: Suspended', example='Running'),
    }
  ](name='ServiceItems', description='Returns real-time data service items'),
  totalRecordCount?: int32(name='TotalRecordCount', description='Total record count.', example='1'),
}

model ListStreamingDataServicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListStreamingDataServicesResponseBody(name='body'),
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request ListStreamingDataServicesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListStreamingDataServicesResponse
 */
async function listStreamingDataServicesWithOptions(request: ListStreamingDataServicesRequest, runtime: Util.RuntimeOptions): ListStreamingDataServicesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListStreamingDataServices',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request ListStreamingDataServicesRequest
 * @return ListStreamingDataServicesResponse
 */
async function listStreamingDataServices(request: ListStreamingDataServicesRequest): ListStreamingDataServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listStreamingDataServicesWithOptions(request, runtime);
}

model ListStreamingDataSourcesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  pageNumber?: int32(name='PageNumber', description='The page number. Pages start from page 1. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values:

*   **30**
*   **50**
*   **100**

Default value: **30**.', example='30'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-beijing'),
}

model ListStreamingDataSourcesResponseBody = {
  dataSourceItems?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the data source was created.', example='2019-09-08T16:00:00Z'),
      dataSourceConfig?: string(name='DataSourceConfig', description='The configurations of the data source.', example='{"brokers":"broker0:9091,broker1:9091","topic":"topic"}'),
      dataSourceDescription?: string(name='DataSourceDescription', description='The description of the data source.', example='test-kafka'),
      dataSourceId?: int32(name='DataSourceId', description='The data source ID.', example='1'),
      dataSourceName?: string(name='DataSourceName', description='The name of the data source.', example='test-kafka'),
      dataSourceType?: string(name='DataSourceType', description='The type of the data source. Valid values:

*   kafka', example='kafka'),
      errorMessage?: string(name='ErrorMessage', description='The information about the service status. For example, if the service is in the exception state, the cause of the exception is displayed. If the service is in the running state, this parameter is left empty.', example='""'),
      modifyTime?: string(name='ModifyTime', description='The time when the data source was last modified.', example='2019-09-08T17:00:00Z'),
      serviceId?: int32(name='ServiceId', description='The service ID.', example='1'),
      status?: string(name='Status', description='The status of the service. Valid values:

*   init
*   running
*   exception', example='running'),
    }
  ](name='DataSourceItems', description='The queried data sources.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalRecordCount?: int32(name='TotalRecordCount', description='The total number of entries returned.', example='2'),
}

model ListStreamingDataSourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListStreamingDataSourcesResponseBody(name='body'),
}

/**
 * @summary Queries real-time service data sources.
 *
 * @param request ListStreamingDataSourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListStreamingDataSourcesResponse
 */
async function listStreamingDataSourcesWithOptions(request: ListStreamingDataSourcesRequest, runtime: Util.RuntimeOptions): ListStreamingDataSourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListStreamingDataSources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries real-time service data sources.
 *
 * @param request ListStreamingDataSourcesRequest
 * @return ListStreamingDataSourcesResponse
 */
async function listStreamingDataSources(request: ListStreamingDataSourcesRequest): ListStreamingDataSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listStreamingDataSourcesWithOptions(request, runtime);
}

model ListStreamingJobsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  pageNumber?: int32(name='PageNumber', description='Page number, greater than 0 and not exceeding the maximum value of Integer. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='Number of records per page, with the following options:
- **30** - **50** - **100**
Default value: 30.', example='kafka'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-beijing'),
}

model ListStreamingJobsResponseBody = {
  jobItems?: [ 
    {
      account?: string(name='Account', description='The name of the database account.', example='test-account'),
      consistency?: string(name='Consistency', description='The delivery guarantee setting.', example='ATLEAST / EXACTLY'),
      createTime?: string(name='CreateTime', description='The time when the job was created.', example='2019-09-08T16:00:00Z'),
      dataSourceId?: string(name='DataSourceId', description='The data source ID.', example='58'),
      dataSourceName?: string(name='DataSourceName', description='The name of the data source.', example='test-kafka'),
      destColumns?: [ string ](name='DestColumns', description='The mapped fields in the destination table.'),
      destDatabase?: string(name='DestDatabase', description='The name of the destination database.', example='dest-db'),
      destSchema?: string(name='DestSchema', description='The name of the destination namespace.', example='dest-schema'),
      destTable?: string(name='DestTable', description='The name of the destination table.', example='dest-table'),
      errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only when the return value of **Status** is **false**.', example='""'),
      fallbackOffset?: string(name='FallbackOffset', description='The fallback offset for data consumption.

*   This parameter indicates the starting offset from which data consumption resumes when a consumer does not request a consumption offset or requests a consumption offset that is beyond the range of the offset information recorded in the current Kafka cluster. Valid values: EARLIEST and LATEST.', example='EARLIEST /  LATEST'),
      jobDescription?: string(name='JobDescription', description='The description of the job.', example='test job'),
      jobId?: string(name='JobId', description='The job ID.', example='1'),
      jobName?: string(name='JobName', description='The name of the job.', example='test-job'),
      matchColumns?: [ string ](name='MatchColumns', description='The update condition columns that are used to join the source data and the destination table. Typically, the columns are all the primary key columns of the destination table. If the values of all columns specified by this parameter in different rows are the same, the rows are considered duplicates.'),
      mode?: string(name='Mode', description='The configuration mode. Valid values:

1.  basic: In basic mode, you must configure the configuration parameters.
2.  professional: In professional mode, you can submit a YAML configuration file.', example='Basic / Professional'),
      modifyTime?: string(name='ModifyTime', description='The time when the job was last modified.', example='2019-09-08T17:00:00Z'),
      password?: string(name='Password', description='The password of the database account.', example='pwd123'),
      srcColumns?: [ string ](name='SrcColumns', description='The source fields.'),
      status?: string(name='Status', description='The status of the job. Valid values:

*   Init
*   Running
*   Exception
*   Paused', example='Running'),
      updateColumns?: [ string ](name='UpdateColumns', description='The columns to be updated if a row of data meets the update condition. Typically, the columns are all non-primary key columns of the destination table. When the columns specified by the MatchColumns parameter are used as conditions to join the source data and the destination table, data in columns of the UpdateColumns type is updated if data is matched.'),
      writeMode?: string(name='WriteMode', description='The write mode.', example='INSERT/UPDATE/MERGE'),
    }
  ](name='JobItems', description='The queried jobs.'),
  pageNumber?: int32(name='PageNumber', description='Current page number.', example='1'),
  pageRecordCount?: int32(name='PageRecordCount', description='Number of records per page.', example='2'),
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
  totalRecordCount?: int32(name='TotalRecordCount', description='Total number of records.', example='2'),
}

model ListStreamingJobsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListStreamingJobsResponseBody(name='body'),
}

/**
 * @summary Queries real-time data synchronization jobs.
 *
 * @param request ListStreamingJobsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListStreamingJobsResponse
 */
async function listStreamingJobsWithOptions(request: ListStreamingJobsRequest, runtime: Util.RuntimeOptions): ListStreamingJobsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListStreamingJobs',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries real-time data synchronization jobs.
 *
 * @param request ListStreamingJobsRequest
 * @return ListStreamingJobsResponse
 */
async function listStreamingJobs(request: ListStreamingJobsRequest): ListStreamingJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listStreamingJobsWithOptions(request, runtime);
}

model ListTablesRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='adbtest'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page. Valid values: 1 to 100.', example='100'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-beijing'),
  schema?: string(name='Schema', description='The name of the schema to which the table belongs.

This parameter is required.', example='public'),
  secretArn?: string(name='SecretArn', description='The Alibaba Cloud Resource Name (ARN) of the access credential for the created Data API account. You can call the CreateSecret operation to create an access credential.

>  To call the ListTables operation as a Resource Access Management (RAM) user, the RAM user must have the permissions to call the UseSecret or GetSecretValue operation on the ARN of the access credential.

This parameter is required.', example='acs:gpdb:cn-beijing:1033**:secret/testsecret-eG2AQGRIwQ0zFp4VA7mYL3uiCXTfDQbQ'),
  tablePattern?: string(name='TablePattern', description='The table name pattern for matching. For example, `ab%` specifies to match table names that start with ab.', example='ab%'),
}

model ListTablesResponseBody = {
  message?: string(name='Message', description='The returned message.', example='success'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
  tables?: {
    tables?: [ string ](name='Tables')
  }(name='Tables', description='The queried tables.'),
}

model ListTablesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTablesResponseBody(name='body'),
}

/**
 * @summary Queries a list of tables in a database.
 *
 * @param request ListTablesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTablesResponse
 */
async function listTablesWithOptions(request: ListTablesRequest, runtime: Util.RuntimeOptions): ListTablesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.schema)) {
    query['Schema'] = request.schema;
  }
  if (!Util.isUnset(request.secretArn)) {
    query['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.tablePattern)) {
    query['TablePattern'] = request.tablePattern;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTables',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of tables in a database.
 *
 * @param request ListTablesRequest
 * @return ListTablesResponse
 */
async function listTables(request: ListTablesRequest): ListTablesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTablesWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', description='The token used to perform the next query.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The ID of instance N. Valid values of N: 1 to 50.', example='gp-xxxxxxxxxx'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  resourceType?: string(name='ResourceType', description='The resource type. Set the value to instance.

This parameter is required.', example='instance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N. The key must be 1 to 64 characters in length.

You can use `Tag.N` to query AnalyticDB for PostgreSQL instances that have specific tags added. Tag.N consists of Tag.N.Key and Tag.N.Value.

Valid values of N: 1 to 20.

*   If you specify only `Tag.N.Key`, all instances that have the tag key added are returned.
*   If you specify only `Tag.N.Value`, the `InvalidParameter.TagValue` error message is returned.
*   If you specify multiple tag key-value pairs at a time, the instances that match all the specified tag key-value pairs are returned.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N. The value must be 1 to 128 characters in length.

Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='The tags that are added to instances.

>  You must specify at least one of the ResourceId and Tag parameters.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='The token used to perform the next query.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='5414A4E5-4C36-4461-95FC-23757A20B5F8'),
  tagResources?: {
    tagResource?: [ 
    {
      resourceId?: string(name='ResourceId', description='The ID of the instance.', example='gp-xxxxxxxxxx'),
      resourceType?: string(name='ResourceType', description='The storage mode of the instance.', example='instance'),
      tagKey?: string(name='TagKey', description='The tag key.', example='TestKey'),
      tagValue?: string(name='TagValue', description='The tag value.', example='TestValue'),
    }
  ](name='TagResource')
  }(name='TagResources', description='Details about the instances and tags, including the instance IDs, instance modes, and tag key-value pairs.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries a list of tags that are added to AnalyticDB for PostgreSQL instances.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of tags that are added to AnalyticDB for PostgreSQL instances.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyAccountDescriptionRequest {
  accountDescription?: string(name='AccountDescription', description='The new description of the database account.

*   The description must start with a letter.
*   The description cannot start with `http://` or `https://`.
*   The description can contain letters, underscores (_), hyphens (-), and digits.
*   The description must be 2 to 256 characters in length.', example='testAccoutdescribe'),
  accountName?: string(name='AccountName', description='The name of the database account.

This parameter is required.', example='testAccout'),
  clientToken?: string(name='ClientToken', description='Idempotence check. For more information, see [How to Ensure Idempotence](https://help.aliyun.com/document_detail/327176.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
}

model ModifyAccountDescriptionResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='99BBBD5E-B5D8-4FC8-B8BF-FB1A0A38BBA2'),
}

model ModifyAccountDescriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyAccountDescriptionResponseBody(name='body'),
}

/**
 * @summary Modifies the description of a database account for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyAccountDescriptionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyAccountDescriptionResponse
 */
async function modifyAccountDescriptionWithOptions(request: ModifyAccountDescriptionRequest, runtime: Util.RuntimeOptions): ModifyAccountDescriptionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountDescription)) {
    query['AccountDescription'] = request.accountDescription;
  }
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyAccountDescription',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the description of a database account for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyAccountDescriptionRequest
 * @return ModifyAccountDescriptionResponse
 */
async function modifyAccountDescription(request: ModifyAccountDescriptionRequest): ModifyAccountDescriptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyAccountDescriptionWithOptions(request, runtime);
}

model ModifyBackupPolicyRequest {
  backupRetentionPeriod?: int32(name='BackupRetentionPeriod', description='The number of days for which data backup files are retained. Default value: 7. Maximum value: 7. Valid values: 1 to 7.', example='7'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

This parameter is required.', example='gp-bp***************'),
  enableRecoveryPoint?: boolean(name='EnableRecoveryPoint', description='Specifies whether to enable automatic point-in-time backup.

*   true
*   false

Default value: true.', example='true'),
  preferredBackupPeriod?: string(name='PreferredBackupPeriod', description='The cycle based on which backups are performed. If more than one day of the week is specified, the days of the week are separated by commas (,). Valid values:

*   Monday
*   Tuesday
*   Wednesday
*   Thursday
*   Friday
*   Saturday
*   Sunday

This parameter is required.', example='Tuesday, Thursday, Saturday'),
  preferredBackupTime?: string(name='PreferredBackupTime', description='The backup window. Specify the backup window in the HH:mmZ-HH:mmZ format. The backup window must be in UTC. Default value: 00:00-01:00.

This parameter is required.', example='15:00Z-16:00Z'),
  recoveryPointPeriod?: string(name='RecoveryPointPeriod', description='The frequency of point-in-time backup.

*   1: per hour
*   2: per 2 hours
*   4: per 4 hours
*   8: per 8 hours

Default value: 8.', example='8'),
}

model ModifyBackupPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='DA147739-AEAD-4417-9089-65**********'),
}

model ModifyBackupPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyBackupPolicyResponseBody(name='body'),
}

/**
 * @summary Configures the backup policy of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyBackupPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyBackupPolicyResponse
 */
async function modifyBackupPolicyWithOptions(request: ModifyBackupPolicyRequest, runtime: Util.RuntimeOptions): ModifyBackupPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupRetentionPeriod)) {
    query['BackupRetentionPeriod'] = request.backupRetentionPeriod;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.enableRecoveryPoint)) {
    query['EnableRecoveryPoint'] = request.enableRecoveryPoint;
  }
  if (!Util.isUnset(request.preferredBackupPeriod)) {
    query['PreferredBackupPeriod'] = request.preferredBackupPeriod;
  }
  if (!Util.isUnset(request.preferredBackupTime)) {
    query['PreferredBackupTime'] = request.preferredBackupTime;
  }
  if (!Util.isUnset(request.recoveryPointPeriod)) {
    query['RecoveryPointPeriod'] = request.recoveryPointPeriod;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupPolicy',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Configures the backup policy of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyBackupPolicyRequest
 * @return ModifyBackupPolicyResponse
 */
async function modifyBackupPolicy(request: ModifyBackupPolicyRequest): ModifyBackupPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupPolicyWithOptions(request, runtime);
}

model ModifyDBInstanceConfigRequest {
  DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.', example='gp-bp12ga6v69h86****'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  idleTime?: int32(name='IdleTime', description='The wait period for the instance that has no traffic to become idle. Minimum value: 60. Default value: 600. Unit: seconds.', example='600'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For more information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  serverlessResource?: int32(name='ServerlessResource', description='The threshold of computing resources. Valid values: 8 to 32. Unit: AnalyticDB Compute Units (ACUs).', example='32'),
}

model ModifyDBInstanceConfigResponseBody = {
  dbInstanceId?: string(name='DbInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned if the operation fails.', example='\\\\"error message\\\\"'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34B32A0A-08EF-4A87-B6BE-CDD9F56FC3AD'),
  status?: boolean(name='Status', description='The state of the operation. Valid values:

*   **0**: The operation failed.
*   **1**: The operation is successful.', example='1'),
}

model ModifyDBInstanceConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceConfigResponseBody(name='body'),
}

/**
 * @summary Changes the threshold of computing resources and the wait period of idle resources for an AnalyticDB for PostgreSQL instance in Serverless automatic scheduling mode.
 *
 * @param request ModifyDBInstanceConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceConfigResponse
 */
async function modifyDBInstanceConfigWithOptions(request: ModifyDBInstanceConfigRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceDescription)) {
    query['DBInstanceDescription'] = request.DBInstanceDescription;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.idleTime)) {
    query['IdleTime'] = request.idleTime;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serverlessResource)) {
    query['ServerlessResource'] = request.serverlessResource;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceConfig',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the threshold of computing resources and the wait period of idle resources for an AnalyticDB for PostgreSQL instance in Serverless automatic scheduling mode.
 *
 * @param request ModifyDBInstanceConfigRequest
 * @return ModifyDBInstanceConfigResponse
 */
async function modifyDBInstanceConfig(request: ModifyDBInstanceConfigRequest): ModifyDBInstanceConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceConfigWithOptions(request, runtime);
}

model ModifyDBInstanceConnectionStringRequest {
  clientToken?: string(name='ClientToken', description='Idempotence check. For more information, see [How to Ensure Idempotence](https://help.aliyun.com/document_detail/327176.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  connectionStringPrefix?: string(name='ConnectionStringPrefix', description='The endpoint prefix of the instance.

This parameter is required.', example='gp-test'),
  currentConnectionString?: string(name='CurrentConnectionString', description='The current endpoint of the instance.

This parameter is required.', example='gp-t4n2qg19bnn98****-master.gpdb.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-t4n2qg19bnn98****'),
  port?: string(name='Port', description='The port number. Example: 5432.

This parameter is required.', example='5432'),
}

model ModifyDBInstanceConnectionStringResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='29B0BF34-D069-4495-92C7-FA6D94528A9E'),
}

model ModifyDBInstanceConnectionStringResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceConnectionStringResponseBody(name='body'),
}

/**
 * @summary Changes the endpoint of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyDBInstanceConnectionStringRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceConnectionStringResponse
 */
async function modifyDBInstanceConnectionStringWithOptions(request: ModifyDBInstanceConnectionStringRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceConnectionStringResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionStringPrefix)) {
    query['ConnectionStringPrefix'] = request.connectionStringPrefix;
  }
  if (!Util.isUnset(request.currentConnectionString)) {
    query['CurrentConnectionString'] = request.currentConnectionString;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceConnectionString',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the endpoint of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyDBInstanceConnectionStringRequest
 * @return ModifyDBInstanceConnectionStringResponse
 */
async function modifyDBInstanceConnectionString(request: ModifyDBInstanceConnectionStringRequest): ModifyDBInstanceConnectionStringResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceConnectionStringWithOptions(request, runtime);
}

model ModifyDBInstanceDeploymentModeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
  deployMode?: string(name='DeployMode', description='This parameter is required.', example='multiple'),
  standbyVSwitchId?: string(name='StandbyVSwitchId', example='vsw-bp1cpq8mr64paltkb****'),
  standbyZoneId?: string(name='StandbyZoneId', example='cn-hangzhou-j'),
}

model ModifyDBInstanceDeploymentModeResponseBody = {
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model ModifyDBInstanceDeploymentModeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceDeploymentModeResponseBody(name='body'),
}

/**
 * @summary 修改实例部署模式
 *
 * @param request ModifyDBInstanceDeploymentModeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceDeploymentModeResponse
 */
async function modifyDBInstanceDeploymentModeWithOptions(request: ModifyDBInstanceDeploymentModeRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceDeploymentModeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.deployMode)) {
    query['DeployMode'] = request.deployMode;
  }
  if (!Util.isUnset(request.standbyVSwitchId)) {
    query['StandbyVSwitchId'] = request.standbyVSwitchId;
  }
  if (!Util.isUnset(request.standbyZoneId)) {
    query['StandbyZoneId'] = request.standbyZoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceDeploymentMode',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改实例部署模式
 *
 * @param request ModifyDBInstanceDeploymentModeRequest
 * @return ModifyDBInstanceDeploymentModeResponse
 */
async function modifyDBInstanceDeploymentMode(request: ModifyDBInstanceDeploymentModeRequest): ModifyDBInstanceDeploymentModeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceDeploymentModeWithOptions(request, runtime);
}

model ModifyDBInstanceDescriptionRequest {
  DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.

The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

This parameter is required.', example='test'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
}

model ModifyDBInstanceDescriptionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='107BE202-D1A2-479E-98E0-A8**********'),
}

model ModifyDBInstanceDescriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceDescriptionResponseBody(name='body'),
}

/**
 * @summary Changes the description of an AnalyticDB for PostgreSQL instance.
 *
 * @description To make it easy to identify AnalyticDB for PostgreSQL instances, you can call this operation to modify the description of instances.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceDescriptionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceDescriptionResponse
 */
async function modifyDBInstanceDescriptionWithOptions(request: ModifyDBInstanceDescriptionRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceDescriptionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceDescription)) {
    query['DBInstanceDescription'] = request.DBInstanceDescription;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceDescription',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the description of an AnalyticDB for PostgreSQL instance.
 *
 * @description To make it easy to identify AnalyticDB for PostgreSQL instances, you can call this operation to modify the description of instances.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceDescriptionRequest
 * @return ModifyDBInstanceDescriptionResponse
 */
async function modifyDBInstanceDescription(request: ModifyDBInstanceDescriptionRequest): ModifyDBInstanceDescriptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceDescriptionWithOptions(request, runtime);
}

model ModifyDBInstanceMaintainTimeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  endTime?: string(name='EndTime', description='The end time of the maintenance window. The end time must be later than the start time. Specify the time in the HH:mmZ format. The time must be in UTC.

This parameter is required.', example='03:00Z'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is no longer used.', example='rg-bp67acfmxazb4p****'),
  startTime?: string(name='StartTime', description='The start time of the maintenance window. Specify the time in the HH:mmZ format. The time must be in UTC.

This parameter is required.', example='02:00Z'),
}

model ModifyDBInstanceMaintainTimeResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='CA9A34C8-AC95-413B-AC6A-CE**********'),
}

model ModifyDBInstanceMaintainTimeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceMaintainTimeResponseBody(name='body'),
}

/**
 * @summary Modifies the maintenance window of an AnalyticDB for PostgreSQL instance.
 *
 * @description The system maintains AnalyticDB for PostgreSQL instances during the maintenance window that you specify. We recommend that you set the maintenance window to off-peak hours to minimize the impact on your business.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceMaintainTimeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceMaintainTimeResponse
 */
async function modifyDBInstanceMaintainTimeWithOptions(request: ModifyDBInstanceMaintainTimeRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceMaintainTimeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceMaintainTime',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the maintenance window of an AnalyticDB for PostgreSQL instance.
 *
 * @description The system maintains AnalyticDB for PostgreSQL instances during the maintenance window that you specify. We recommend that you set the maintenance window to off-peak hours to minimize the impact on your business.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceMaintainTimeRequest
 * @return ModifyDBInstanceMaintainTimeResponse
 */
async function modifyDBInstanceMaintainTime(request: ModifyDBInstanceMaintainTimeRequest): ModifyDBInstanceMaintainTimeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceMaintainTimeWithOptions(request, runtime);
}

model ModifyDBInstanceNetworkTypeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  instanceNetworkType?: string(name='InstanceNetworkType', description='The new network type of the instance. Valid values:

*   VPC
*   Classic

This parameter is required.', example='VPC'),
  privateIpAddress?: string(name='PrivateIpAddress', description='The internal IP address of the instance.', example='10.10.XX.XX'),
  VPCId?: string(name='VPCId', description='The virtual private cloud (VPC) ID of the instance.', example='vpc-bp19ame5m1r3oejns****'),
  vSwitchId?: string(name='VSwitchId', description='The vSwitch ID of the instance. This parameter must be specified when VPCId is specified.', example='vsw-bp1cpq8mr64paltkb****'),
}

model ModifyDBInstanceNetworkTypeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='2d0c35a9-f5da-44ba-852d-741e27b7eb0b'),
}

model ModifyDBInstanceNetworkTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceNetworkTypeResponseBody(name='body'),
}

/**
 * @summary Changes the network type of an AnalyticDB for PostgreSQL instance.
 *
 * @description ##
 * This operation is available only for AnalyticDB for PostgreSQL instances in reserved storage mode.
 * ## QPS limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceNetworkTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceNetworkTypeResponse
 */
async function modifyDBInstanceNetworkTypeWithOptions(request: ModifyDBInstanceNetworkTypeRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceNetworkTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.instanceNetworkType)) {
    query['InstanceNetworkType'] = request.instanceNetworkType;
  }
  if (!Util.isUnset(request.privateIpAddress)) {
    query['PrivateIpAddress'] = request.privateIpAddress;
  }
  if (!Util.isUnset(request.VPCId)) {
    query['VPCId'] = request.VPCId;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceNetworkType',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the network type of an AnalyticDB for PostgreSQL instance.
 *
 * @description ##
 * This operation is available only for AnalyticDB for PostgreSQL instances in reserved storage mode.
 * ## QPS limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyDBInstanceNetworkTypeRequest
 * @return ModifyDBInstanceNetworkTypeResponse
 */
async function modifyDBInstanceNetworkType(request: ModifyDBInstanceNetworkTypeRequest): ModifyDBInstanceNetworkTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceNetworkTypeWithOptions(request, runtime);
}

model ModifyDBInstancePayTypeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp***************'),
  payType?: string(name='PayType', description='The billing method of the instance. Valid values:

*   Postpaid: pay-as-you-go.
*   Prepaid: subscription.

This parameter is required.', example='Postpaid'),
  period?: string(name='Period', description='The unit of the subscription duration. Valid values:

*   Month
*   Year

This parameter must be specified only when PayType is set to Prepaid.', example='Month'),
  usedTime?: int32(name='UsedTime', description='The subscription duration.

*   Valid values when Period is set to Month: 1 to 9.
*   Valid values when Period is set to Year: 1 to 3.

This parameter must be specified only when PayType is set to Prepaid.', example='1'),
}

model ModifyDBInstancePayTypeResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp***************'),
  orderId?: string(name='OrderId', description='The order ID.', example='50578361067****'),
  requestId?: string(name='RequestId', description='Id of the request', example='7565770E-7C45-462D-BA4A-8A5396F2****'),
}

model ModifyDBInstancePayTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstancePayTypeResponseBody(name='body'),
}

/**
 * @summary 包年包月/按量付费转换改造
 *
 * @param request ModifyDBInstancePayTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstancePayTypeResponse
 */
async function modifyDBInstancePayTypeWithOptions(request: ModifyDBInstancePayTypeRequest, runtime: Util.RuntimeOptions): ModifyDBInstancePayTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstancePayType',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 包年包月/按量付费转换改造
 *
 * @param request ModifyDBInstancePayTypeRequest
 * @return ModifyDBInstancePayTypeResponse
 */
async function modifyDBInstancePayType(request: ModifyDBInstancePayTypeRequest): ModifyDBInstancePayTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstancePayTypeWithOptions(request, runtime);
}

model ModifyDBInstanceResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the resource group to which you want to move the instance. For more information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).

This parameter is required.', example='rg-bp67acfmxazb4b****'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For more information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ModifyDBInstanceResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='65BDA532-28AF-4122-AA39-B382721EEE64'),
}

model ModifyDBInstanceResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceResourceGroupResponseBody(name='body'),
}

/**
 * @summary Moves an AnalyticDB for PostgreSQL instance to a resource group.
 *
 * @description Resource Management allows you to build an organizational structure for resources based on your business requirements. You can use resource directories, folders, accounts, and resource groups to hierarchically organize and manage resources. For more information, see [What is Resource Management?](https://help.aliyun.com/document_detail/94475.html)
 *
 * @param request ModifyDBInstanceResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceResourceGroupResponse
 */
async function modifyDBInstanceResourceGroupWithOptions(request: ModifyDBInstanceResourceGroupRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.newResourceGroupId)) {
    query['NewResourceGroupId'] = request.newResourceGroupId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Moves an AnalyticDB for PostgreSQL instance to a resource group.
 *
 * @description Resource Management allows you to build an organizational structure for resources based on your business requirements. You can use resource directories, folders, accounts, and resource groups to hierarchically organize and manage resources. For more information, see [What is Resource Management?](https://help.aliyun.com/document_detail/94475.html)
 *
 * @param request ModifyDBInstanceResourceGroupRequest
 * @return ModifyDBInstanceResourceGroupResponse
 */
async function modifyDBInstanceResourceGroup(request: ModifyDBInstanceResourceGroupRequest): ModifyDBInstanceResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceResourceGroupWithOptions(request, runtime);
}

model ModifyDBInstanceSSLRequest {
  connectionString?: string(name='ConnectionString', description='The encrypted endpoint. By default, the wildcards are used for instances that are hosted on ECS instances. This way, the endpoints that can be resolved to the same IP address are encrypted.', example='gp-xxxxxxxxxxx-master.gpdbmaster.singapore.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

This parameter is required.', example='gp-xxxxxxxxxxx'),
  SSLEnabled?: int32(name='SSLEnabled', description='The status of SSL encryption. Valid values:

*   0: disables SSL encryption.
*   1: enables SSL encryption.
*   2: updates SSL encryption.

This parameter is required.', example='1'),
}

model ModifyDBInstanceSSLResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='ADD6EA90-EECB-4C12-9F26-0B6DB58710EF'),
}

model ModifyDBInstanceSSLResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBInstanceSSLResponseBody(name='body'),
}

/**
 * @summary Enables, disables, or updates SSL encryption for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyDBInstanceSSLRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBInstanceSSLResponse
 */
async function modifyDBInstanceSSLWithOptions(request: ModifyDBInstanceSSLRequest, runtime: Util.RuntimeOptions): ModifyDBInstanceSSLResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.connectionString)) {
    query['ConnectionString'] = request.connectionString;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.SSLEnabled)) {
    query['SSLEnabled'] = request.SSLEnabled;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBInstanceSSL',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables, disables, or updates SSL encryption for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyDBInstanceSSLRequest
 * @return ModifyDBInstanceSSLResponse
 */
async function modifyDBInstanceSSL(request: ModifyDBInstanceSSLRequest): ModifyDBInstanceSSLResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBInstanceSSLWithOptions(request, runtime);
}

model ModifyDBResourceGroupRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupItems?: [ 
    {
      resourceGroupConfig?: string(name='ResourceGroupConfig', description='The configurations of the resource group to which you want to modify.

> 

*   CpuRateLimit: the percentage of CPU resources that are available for the resource group. Unit: %.

*   MemoryLimit: the percentage of memory resources that are available for the resource group. Unit: %.

*   MemorySharedQuota: the percentage of memory resources shared among transactions that are submitted to the resource group. Unit: %. Default value: 80.

*   MemorySpillRatio: the memory spill ratio for memory-intensive transactions. When the memory that is used by memory-intensive transactions reaches this value, data is spilled to disks. Unit: %. Default value: 0.

*   Concurrency: the maximum number of concurrent transactions or parallel queries that are allowed for a resource group. Default value: 20.

This parameter is required.', example='{"CpuRateLimit":"10","MemoryLimit":"12","MemorySharedQuota":"20","MemorySpillRatio":"75","Concurrency":"3"}'),
      resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
    }
  ](name='ResourceGroupItems', description='The information about the resource group.

This parameter is required.'),
}

model ModifyDBResourceGroupShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupItemsShrink?: string(name='ResourceGroupItems', description='The information about the resource group.

This parameter is required.'),
}

model ModifyDBResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model ModifyDBResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBResourceGroupResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a resource group.
 *
 * @param tmpReq ModifyDBResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBResourceGroupResponse
 */
async function modifyDBResourceGroupWithOptions(tmpReq: ModifyDBResourceGroupRequest, runtime: Util.RuntimeOptions): ModifyDBResourceGroupResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyDBResourceGroupShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceGroupItems)) {
    request.resourceGroupItemsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceGroupItems, 'ResourceGroupItems', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupItemsShrink)) {
    query['ResourceGroupItems'] = request.resourceGroupItemsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBResourceGroup',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a resource group.
 *
 * @param request ModifyDBResourceGroupRequest
 * @return ModifyDBResourceGroupResponse
 */
async function modifyDBResourceGroup(request: ModifyDBResourceGroupRequest): ModifyDBResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBResourceGroupWithOptions(request, runtime);
}

model ModifyExternalDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-hangzhou'),
  serviceDescription?: string(name='ServiceDescription', description='Service description.', example='pxf test'),
  serviceId?: string(name='ServiceId', description='Service ID.

This parameter is required.', example='1'),
  serviceSpec?: string(name='ServiceSpec', description='Service specification (in CU), value:

- 8

This parameter is required.', example='8'),
}

model ModifyExternalDataServiceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model ModifyExternalDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyExternalDataServiceResponseBody(name='body'),
}

/**
 * @summary Modify External Data Service
 *
 * @param request ModifyExternalDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyExternalDataServiceResponse
 */
async function modifyExternalDataServiceWithOptions(request: ModifyExternalDataServiceRequest, runtime: Util.RuntimeOptions): ModifyExternalDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceDescription)) {
    query['ServiceDescription'] = request.serviceDescription;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.serviceSpec)) {
    query['ServiceSpec'] = request.serviceSpec;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyExternalDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modify External Data Service
 *
 * @param request ModifyExternalDataServiceRequest
 * @return ModifyExternalDataServiceResponse
 */
async function modifyExternalDataService(request: ModifyExternalDataServiceRequest): ModifyExternalDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyExternalDataServiceWithOptions(request, runtime);
}

model ModifyHadoopDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Service description, with a maximum length of 256 characters.', example='pxf for hdfs data source'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.', example='123'),
  dataSourceType?: string(name='DataSourceType', description='The type of the data source. Valid values:

*   mysql

- postgresql

*   hdfs

- hive', example='mysql'),
  emrInstanceId?: string(name='EmrInstanceId', description='When HadoopCreateType is Emr, the value of this field is the EMR instance ID.', example='c-1234567'),
  HDFSConf?: string(name='HDFSConf', description='The content of the Hadoop hdfs-site.xml file. This parameter must be specified when DataSourceType is set to HDFS.', example='xxxxxx'),
  hadoopCoreConf?: string(name='HadoopCoreConf', description='The content of the Hadoop core-site.xml file.', example='xxxxxx'),
  hadoopCreateType?: string(name='HadoopCreateType', description='The type of the external service. Valid values:

*   emr: E-MapReduce (EMR) Hadoop cluster.
*   selfCreate: self-managed Hadoop cluster.', example='emr'),
  hadoopHostsAddress?: string(name='HadoopHostsAddress', description='The IP address and hostname of the Hadoop cluster (data source) in the /etc/hosts file.', example='127.0.0.1 localhost'),
  hiveConf?: string(name='HiveConf', description='The content of the Hadoop hive-site.xml file. This parameter must be specified when DataSourceType is set to Hive.', example='xxxxxx'),
  mapReduceConf?: string(name='MapReduceConf', description='The content of the Hadoop mapred-site.xml file. This parameter must be specified when DataSourceType is set to HDFS.', example='<?xml version="1.0" ?>
<!-- Created at 2023-08-15 13:53:28.962 -->
<configuration>
    <property>
        <name>mapreduce.map.speculative</name>
        <value>true</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.keytab</name>
        <value></value>
    </property>
</configuration>'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
  yarnConf?: string(name='YarnConf', description='The content of the Hadoop yarn-site.xml file. This parameter must be specified when DataSourceType is set to HDFS.', example='xxxxxx'),
}

model ModifyHadoopDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='2C125605-266F-41CA-8AC5-3A643D4F42C5'),
}

model ModifyHadoopDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHadoopDataSourceResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a Hadoop data source.
 *
 * @param request ModifyHadoopDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHadoopDataSourceResponse
 */
async function modifyHadoopDataSourceWithOptions(request: ModifyHadoopDataSourceRequest, runtime: Util.RuntimeOptions): ModifyHadoopDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    query['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.emrInstanceId)) {
    query['EmrInstanceId'] = request.emrInstanceId;
  }
  if (!Util.isUnset(request.HDFSConf)) {
    query['HDFSConf'] = request.HDFSConf;
  }
  if (!Util.isUnset(request.hadoopCoreConf)) {
    query['HadoopCoreConf'] = request.hadoopCoreConf;
  }
  if (!Util.isUnset(request.hadoopCreateType)) {
    query['HadoopCreateType'] = request.hadoopCreateType;
  }
  if (!Util.isUnset(request.hadoopHostsAddress)) {
    query['HadoopHostsAddress'] = request.hadoopHostsAddress;
  }
  if (!Util.isUnset(request.hiveConf)) {
    query['HiveConf'] = request.hiveConf;
  }
  if (!Util.isUnset(request.mapReduceConf)) {
    query['MapReduceConf'] = request.mapReduceConf;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.yarnConf)) {
    query['YarnConf'] = request.yarnConf;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyHadoopDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a Hadoop data source.
 *
 * @param request ModifyHadoopDataSourceRequest
 * @return ModifyHadoopDataSourceResponse
 */
async function modifyHadoopDataSource(request: ModifyHadoopDataSourceRequest): ModifyHadoopDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyHadoopDataSourceWithOptions(request, runtime);
}

model ModifyJDBCDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

This parameter is required.', example='gp-xxxxxxx'),
  dataSourceDescription?: string(name='DataSourceDescription', description='Data source description.', example='test'),
  dataSourceId?: string(name='DataSourceId', description='Data source ID.

This parameter is required.', example='123'),
  dataSourceType?: string(name='DataSourceType', description='Database type: - mysql - postgresql - sqlserver', example='mysql'),
  JDBCConnectionString?: string(name='JDBCConnectionString', description='The JDBC connection string.', example='xxxxxx'),
  JDBCPassword?: string(name='JDBCPassword', description='The password of the database account.', example='xxxxxx'),
  JDBCUserName?: string(name='JDBCUserName', description='The name of the database account.', example='xxxxxx'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-shanghai'),
}

model ModifyJDBCDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='2C125605-266F-41CA-8AC5-3A643D4F42C5'),
}

model ModifyJDBCDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyJDBCDataSourceResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a Java Database Connectivity (JDBC) data source.
 *
 * @param request ModifyJDBCDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyJDBCDataSourceResponse
 */
async function modifyJDBCDataSourceWithOptions(request: ModifyJDBCDataSourceRequest, runtime: Util.RuntimeOptions): ModifyJDBCDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    query['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.JDBCConnectionString)) {
    query['JDBCConnectionString'] = request.JDBCConnectionString;
  }
  if (!Util.isUnset(request.JDBCPassword)) {
    query['JDBCPassword'] = request.JDBCPassword;
  }
  if (!Util.isUnset(request.JDBCUserName)) {
    query['JDBCUserName'] = request.JDBCUserName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyJDBCDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a Java Database Connectivity (JDBC) data source.
 *
 * @param request ModifyJDBCDataSourceRequest
 * @return ModifyJDBCDataSourceResponse
 */
async function modifyJDBCDataSource(request: ModifyJDBCDataSourceRequest): ModifyJDBCDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyJDBCDataSourceWithOptions(request, runtime);
}

model ModifyMasterSpecRequest {
  DBInstanceDescription?: string(name='DBInstanceDescription', description='The description of the instance.', example='test'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a region.

This parameter is required.', example='gp-xxxxxxxxx'),
  masterAISpec?: string(name='MasterAISpec', description='This parameter must be specified if you want to change coordinator nodes to AI coordinator nodes.
>-  You cannot specify the MasterAISpec and MasterCU parameters at the same time.
>- You can change coordinator nodes to AI coordinator nodes only in specific regions and zones.
>- Only AnalyticDB for PostgreSQL V7.0 instances of Basic Edition support AI coordinator nodes.
>- You can view the valid values of this parameter on the configuration change page of coordinator nodes.', example='ADB.AIMedium.2'),
  masterCU?: int32(name='MasterCU', description='The specifications of coordinator node resources. Valid values:

*   2 CU
*   4 CU
*   8 CU
*   16 CU
*   32 CU

>  You are charged for coordinator node resources of more than 8 compute units (CUs).', example='8 CU'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
}

model ModifyMasterSpecResponseBody = {
  dbInstanceId?: string(name='DbInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The returned message.

This parameter is returned only if the request fails.', example='******'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: boolean(name='Status', description='Indicates whether the request was successful. Valid values:

*   **false**
*   **true**', example='true'),
}

model ModifyMasterSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyMasterSpecResponseBody(name='body'),
}

/**
 * @summary Changes the specifications of coordinator node resources for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request ModifyMasterSpecRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyMasterSpecResponse
 */
async function modifyMasterSpecWithOptions(request: ModifyMasterSpecRequest, runtime: Util.RuntimeOptions): ModifyMasterSpecResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceDescription)) {
    query['DBInstanceDescription'] = request.DBInstanceDescription;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.masterAISpec)) {
    query['MasterAISpec'] = request.masterAISpec;
  }
  if (!Util.isUnset(request.masterCU)) {
    query['MasterCU'] = request.masterCU;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyMasterSpec',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the specifications of coordinator node resources for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request ModifyMasterSpecRequest
 * @return ModifyMasterSpecResponse
 */
async function modifyMasterSpec(request: ModifyMasterSpecRequest): ModifyMasterSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyMasterSpecWithOptions(request, runtime);
}

model ModifyParametersRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp***************'),
  forceRestartInstance?: boolean(name='ForceRestartInstance', description='Specifies whether to forcibly restart the instance. Valid values:

*   **true**
*   **false**', example='false'),
  parameters?: string(name='Parameters', description='The name and value of the parameter to be modified. Specify the parameter in the `<Parameter name>:<Parameter value>` format.

You can call the [DescribeParameters](https://help.aliyun.com/document_detail/208310.html) operation to query the parameters that can be modified.

This parameter is required.', example='{"statement_timeout":"11800010"}'),
}

model ModifyParametersResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='3FE698B6-6579-547C-A403-07**********'),
}

model ModifyParametersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyParametersResponseBody(name='body'),
}

/**
 * @summary Modifies the configuration parameters of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation can be called to modify parameters of an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyParametersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyParametersResponse
 */
async function modifyParametersWithOptions(request: ModifyParametersRequest, runtime: Util.RuntimeOptions): ModifyParametersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.forceRestartInstance)) {
    query['ForceRestartInstance'] = request.forceRestartInstance;
  }
  if (!Util.isUnset(request.parameters)) {
    query['Parameters'] = request.parameters;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyParameters',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configuration parameters of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation can be called to modify parameters of an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyParametersRequest
 * @return ModifyParametersResponse
 */
async function modifyParameters(request: ModifyParametersRequest): ModifyParametersResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyParametersWithOptions(request, runtime);
}

model ModifyRemoteADBDataSourceRequest {
  dataSourceId?: string(name='DataSourceId', description='Service ID

This parameter is required.', example='1'),
  dataSourceName?: string(name='DataSourceName', description='Specified dataSourceName.', example='test'),
  localDBInstanceId?: string(name='LocalDBInstanceId', description='The ID of the local data instance being used.

This parameter is required.', example='gp-test'),
  ownerId?: long(name='OwnerId'),
  userName?: string(name='UserName', description='New user name.

This parameter is required.', example='newUserName'),
  userPassword?: string(name='UserPassword', description='New user password, which must be transmitted in encrypted form.

This parameter is required.', example='newUserPassword'),
}

model ModifyRemoteADBDataSourceResponseBody = {
  dataSourceItem?: {
    dataSourceName?: string(name='DataSourceName', description='Data source name.', example='db1_gptest1_to_db2_gp-test2'),
    description?: string(name='Description', description='Description information.', example='test'),
    id?: long(name='Id', description='ID', example='1'),
    localDatabase?: string(name='LocalDatabase', description='Local database name', example='db1'),
    localInstanceName?: string(name='LocalInstanceName', description='Local instance name', example='gp-test1'),
    managerUserName?: string(name='ManagerUserName', description='Manager user name', example='test'),
    regionId?: string(name='RegionId', description='Region ID where the instance is located.', example='cn-beijing'),
    remoteDatabase?: string(name='RemoteDatabase', description='Remote database name', example='db2'),
    remoteInstanceName?: string(name='RemoteInstanceName', description='Remote instance name', example='gp-test2'),
    status?: string(name='Status', description='Data source status', example='creating'),
    userName?: string(name='UserName', description='User name', example='user1'),
  }(name='DataSourceItem', description='Returns the successfully modified data sharing service data.'),
  requestId?: string(name='RequestId', description='Request ID.', example='e9d60eb1-e90d-4bc6-a470-c8b767460858'),
  taskId?: int32(name='TaskId', description='Task ID.', example='90000'),
}

model ModifyRemoteADBDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRemoteADBDataSourceResponseBody(name='body'),
}

/**
 * @summary Modify Homogeneous Data Source
 *
 * @param request ModifyRemoteADBDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRemoteADBDataSourceResponse
 */
async function modifyRemoteADBDataSourceWithOptions(request: ModifyRemoteADBDataSourceRequest, runtime: Util.RuntimeOptions): ModifyRemoteADBDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.dataSourceName)) {
    query['DataSourceName'] = request.dataSourceName;
  }
  if (!Util.isUnset(request.localDBInstanceId)) {
    query['LocalDBInstanceId'] = request.localDBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  if (!Util.isUnset(request.userPassword)) {
    query['UserPassword'] = request.userPassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyRemoteADBDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modify Homogeneous Data Source
 *
 * @param request ModifyRemoteADBDataSourceRequest
 * @return ModifyRemoteADBDataSourceResponse
 */
async function modifyRemoteADBDataSource(request: ModifyRemoteADBDataSourceRequest): ModifyRemoteADBDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyRemoteADBDataSourceWithOptions(request, runtime);
}

model ModifySQLCollectorPolicyRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

This parameter is required.', example='gp-xxxxxxxx'),
  SQLCollectorStatus?: string(name='SQLCollectorStatus', description='Specifies whether to enable or disable SQL collection.

*   Enable: enables SQL collection.
*   Disabled: disables SQL collection.

This parameter is required.', example='Enable'),
}

model ModifySQLCollectorPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='4FA1F1D1-50A6-4F60-9A78-5752F2076A53'),
}

model ModifySQLCollectorPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySQLCollectorPolicyResponseBody(name='body'),
}

/**
 * @summary Enables or disables the SQL Explorer feature for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL instances in reserved storage mode.
 * *   You can call this operation only for AnalyticDB for PostgreSQL instances in Serverless automatic scheduling mode.
 *
 * @param request ModifySQLCollectorPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySQLCollectorPolicyResponse
 */
async function modifySQLCollectorPolicyWithOptions(request: ModifySQLCollectorPolicyRequest, runtime: Util.RuntimeOptions): ModifySQLCollectorPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.SQLCollectorStatus)) {
    query['SQLCollectorStatus'] = request.SQLCollectorStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySQLCollectorPolicy',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables the SQL Explorer feature for an AnalyticDB for PostgreSQL instance.
 *
 * @description *   You can call this operation only for AnalyticDB for PostgreSQL instances in reserved storage mode.
 * *   You can call this operation only for AnalyticDB for PostgreSQL instances in Serverless automatic scheduling mode.
 *
 * @param request ModifySQLCollectorPolicyRequest
 * @return ModifySQLCollectorPolicyResponse
 */
async function modifySQLCollectorPolicy(request: ModifySQLCollectorPolicyRequest): ModifySQLCollectorPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySQLCollectorPolicyWithOptions(request, runtime);
}

model ModifySecurityIpsRequest {
  DBInstanceIPArrayAttribute?: string(name='DBInstanceIPArrayAttribute', description='The attribute of the IP address whitelist. By default, this parameter is empty. A whitelist with the `hidden` attribute does not appear in the console.', example='hidden'),
  DBInstanceIPArrayName?: string(name='DBInstanceIPArrayName', description='The name of the whitelist. If you do not enter a name, IP addresses are added to the default whitelist.

>  You can create up to 50 whitelists for an instance.', example='default'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the instance IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  modifyMode?: string(name='ModifyMode', description='The method of modification. Valid values:

*   **Cover**: overwrites the whitelist.
*   **Append**: appends data to the whitelist.
*   **Delete**: deletes the whitelist.', example='0'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For more information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  securityIPList?: string(name='SecurityIPList', description='The IP addresses listed in the whitelist. You can add up to 1,000 IP addresses to the whitelist. Separate multiple IP addresses with commas (,). The IP addresses must use one of the following formats:

*   0.0.0.0/0
*   10.23.12.24. This is a standard IP address.
*   10.23.12.24/24. This is a CIDR block. The value `/24` indicates that the prefix of the CIDR block is 24-bit long. You can replace 24 with a value in the range of `1 to 32`.

This parameter is required.', example='``10.10.**.**``'),
}

model ModifySecurityIpsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='871C698F-B43D-4D1D-ACD6-DF56B0F89978'),
}

model ModifySecurityIpsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySecurityIpsResponseBody(name='body'),
}

/**
 * @summary Modifies the IP address whitelist of an AnalyticDB for PostgreSQL instance.
 *
 * @description To ensure the security and stability of AnalyticDB for PostgreSQL instances, the system denies all external IP addresses to access AnalyticDB for PostgreSQL instances by default. Before you can use an AnalyticDB for PostgreSQL instance, you must add the IP address or CIDR block of your client to the IP address whitelist of the instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifySecurityIpsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySecurityIpsResponse
 */
async function modifySecurityIpsWithOptions(request: ModifySecurityIpsRequest, runtime: Util.RuntimeOptions): ModifySecurityIpsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceIPArrayAttribute)) {
    query['DBInstanceIPArrayAttribute'] = request.DBInstanceIPArrayAttribute;
  }
  if (!Util.isUnset(request.DBInstanceIPArrayName)) {
    query['DBInstanceIPArrayName'] = request.DBInstanceIPArrayName;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.modifyMode)) {
    query['ModifyMode'] = request.modifyMode;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.securityIPList)) {
    query['SecurityIPList'] = request.securityIPList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySecurityIps',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the IP address whitelist of an AnalyticDB for PostgreSQL instance.
 *
 * @description To ensure the security and stability of AnalyticDB for PostgreSQL instances, the system denies all external IP addresses to access AnalyticDB for PostgreSQL instances by default. Before you can use an AnalyticDB for PostgreSQL instance, you must add the IP address or CIDR block of your client to the IP address whitelist of the instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifySecurityIpsRequest
 * @return ModifySecurityIpsResponse
 */
async function modifySecurityIps(request: ModifySecurityIpsRequest): ModifySecurityIpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySecurityIpsWithOptions(request, runtime);
}

model ModifyStreamingDataServiceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp10g78o9807yv9h3'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  serviceDescription?: string(name='ServiceDescription', description='The description of the service.', example='test-adbpgss'),
  serviceId?: string(name='ServiceId', description='The service ID.

This parameter is required.', example='1'),
  serviceSpec?: string(name='ServiceSpec', description='The specifications of the service. Unit: capacity units (CUs). Valid values:

*   2
*   4
*   8
*   16

This parameter is required.', example='2'),
}

model ModifyStreamingDataServiceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model ModifyStreamingDataServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyStreamingDataServiceResponseBody(name='body'),
}

/**
 * @summary Modifies a real-time data service.
 *
 * @param request ModifyStreamingDataServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyStreamingDataServiceResponse
 */
async function modifyStreamingDataServiceWithOptions(request: ModifyStreamingDataServiceRequest, runtime: Util.RuntimeOptions): ModifyStreamingDataServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serviceDescription)) {
    query['ServiceDescription'] = request.serviceDescription;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.serviceSpec)) {
    query['ServiceSpec'] = request.serviceSpec;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyStreamingDataService',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a real-time data service.
 *
 * @param request ModifyStreamingDataServiceRequest
 * @return ModifyStreamingDataServiceResponse
 */
async function modifyStreamingDataService(request: ModifyStreamingDataServiceRequest): ModifyStreamingDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyStreamingDataServiceWithOptions(request, runtime);
}

model ModifyStreamingDataSourceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/196830.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-k2j36a3172b102593'),
  dataSourceConfig?: string(name='DataSourceConfig', description='The configurations of the data source.', example='{"brokers":"broker0:9091,broker1:9091","topic":"topic"}'),
  dataSourceDescription?: string(name='DataSourceDescription', description='The description of the data source.', example='test-kafka'),
  dataSourceId?: string(name='DataSourceId', description='The data source ID.

This parameter is required.', example='57'),
  regionId?: string(name='RegionId', description='The region ID.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-beijing'),
}

model ModifyStreamingDataSourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model ModifyStreamingDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyStreamingDataSourceResponseBody(name='body'),
}

/**
 * @summary Modifies a real-time service data source.
 *
 * @param request ModifyStreamingDataSourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyStreamingDataSourceResponse
 */
async function modifyStreamingDataSourceWithOptions(request: ModifyStreamingDataSourceRequest, runtime: Util.RuntimeOptions): ModifyStreamingDataSourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.dataSourceConfig)) {
    query['DataSourceConfig'] = request.dataSourceConfig;
  }
  if (!Util.isUnset(request.dataSourceDescription)) {
    query['DataSourceDescription'] = request.dataSourceDescription;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyStreamingDataSource',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a real-time service data source.
 *
 * @param request ModifyStreamingDataSourceRequest
 * @return ModifyStreamingDataSourceResponse
 */
async function modifyStreamingDataSource(request: ModifyStreamingDataSourceRequest): ModifyStreamingDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyStreamingDataSourceWithOptions(request, runtime);
}

model ModifyStreamingJobRequest {
  account?: string(name='Account', description='Account name.', example='test-account'),
  consistency?: string(name='Consistency', description='The delivery guarantee setting.', example='ATLEAST / EXACTLY'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID

This parameter is required.', example='ModifyStreamingJob'),
  destColumns?: [ string ](name='DestColumns', description='Target data table mapping field list.'),
  destDatabase?: string(name='DestDatabase', description='Target database name.', example='dest-db'),
  destSchema?: string(name='DestSchema', description='Target schema.', example='dest-schema'),
  destTable?: string(name='DestTable', description='Target table name.', example='dest-table'),
  errorLimitCount?: long(name='ErrorLimitCount', description='When the data in Kafka does not match the ADBPG target table, it will cause a write failure. This value is the number of error rows allowed; exceeding this will cause the task to fail.', example='5'),
  fallbackOffset?: string(name='FallbackOffset', description='The fallback offset for data consumption.

*   This parameter specifies the starting offset from which data consumption resumes when a consumer does not request a consumption offset or requests a consumption offset that is beyond the range of the offset information recorded in the current Kafka cluster. You can choose to start data consumption from the earliest or latest offset.

Valid values:
*   EARLIEST
*   LATEST', example='EARLIEST /  LATEST'),
  groupName?: string(name='GroupName', description='Kafka group name', example='group_name'),
  jobConfig?: string(name='JobConfig', description='Job configuration file, required for professional mode.', example='DATABASE: adbpgss_test
USER: adbpgss_test
PASSWORD: adbpgssTest
HOST: gp-xxx-master.gpdb.rds-aliyun-pre.rds.aliyuncs.com
PORT: 5432
KAFKA:
  INPUT:
    SOURCE:
      BROKERS: broker1:9092,broker2:9092,broker3:9092
      TOPIC: testtopic
      FALLBACK_OFFSET: earliest
    KEY:
      COLUMNS:
      - NAME: customer_id
        TYPE: int
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    VALUE:
      COLUMNS:
      - TYPE: integer
        NAME: l_orderkey
      - TYPE: integer
        NAME: l_partkey
      - TYPE: integer
        NAME: l_suppkey
      - TYPE: integer
        NAME: l_linenumber
      - TYPE: decimal
        NAME: l_quantity
      - TYPE: decimal
        NAME: l_extendedprice
      - TYPE: decimal
        NAME: l_discount
      - TYPE: decimal
        NAME: l_tax
      - TYPE: char
        NAME: l_returnflag
      - TYPE: char
        NAME: l_linestatus
      - TYPE: date
        NAME: l_shipdate
      - TYPE: date
        NAME: l_commitdate
      - TYPE: date
        NAME: l_receiptdate
      - TYPE: text
        NAME: l_shipinstruct
      - TYPE: text
        NAME: l_shipmode
      - TYPE: text
        NAME: l_comment
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    ERROR_LIMIT: 10
  OUTPUT:
    SCHEMA: adbpgss_test
    TABLE: write_with_insert_plaintext
    MODE: MERGE
    MATCH_COLUMNS:
    - l_orderkey
    - l_partkey
    - l_suppkey
    UPDATE_COLUMNS:
    - l_linenumber
    - l_quantity
    - l_extendedprice
    - l_discount
    - l_tax
    - l_returnflag
    - l_linestatus
    - l_shipdate
    - l_commitdate
    - l_receiptdate
    - l_shipinstruct
    - l_shipmode
    - l_comment
    MAPPING:
    - EXPRESSION: l_orderkey
      NAME: l_orderkey
    - EXPRESSION: l_partkey
      NAME: l_partkey
    - EXPRESSION: l_suppkey
      NAME: l_suppkey
    - EXPRESSION: l_linenumber
      NAME: l_linenumber
    - EXPRESSION: l_quantity
      NAME: l_quantity
    - EXPRESSION: l_extendedprice
      NAME: l_extendedprice
    - EXPRESSION: l_discount
      NAME: l_discount
    - EXPRESSION: l_tax
      NAME: l_tax
    - EXPRESSION: l_returnflag
      NAME: l_returnflag
    - EXPRESSION: l_linestatus
      NAME: l_linestatus
    - EXPRESSION: l_shipdate
      NAME: l_shipdate
    - EXPRESSION: l_commitdate
      NAME: l_commitdate
    - EXPRESSION: l_receiptdate
      NAME: l_receiptdate
    - EXPRESSION: l_shipinstruct
      NAME: l_shipinstruct
    - EXPRESSION: l_shipmode
      NAME: l_shipmode
    - EXPRESSION: l_comment
      NAME: l_comment
  COMMIT:
    MAX_ROW: 1000
    MINIMAL_INTERVAL: 1000
    CONSISTENCY: ATLEAST
  POLL:
    BATCHSIZE: 1000
    TIMEOUT: 1000
  PROPERTIES:
    group.id: testgroup'),
  jobDescription?: string(name='JobDescription', description='Job description.', example='test-job'),
  jobId?: long(name='JobId', description='Job ID.

This parameter is required.', example='1'),
  matchColumns?: [ string ](name='MatchColumns', description='Match columns, usually all primary key columns of the target table. If all column values in this configuration are the same, the two rows of data are considered duplicates.'),
  password?: string(name='Password', description='Password.', example='pwd123'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
  srcColumns?: [ string ](name='SrcColumns', description='Source data field list.'),
  tryRun?: boolean(name='TryRun', description='Specifies whether to test the real-time job. Valid values:

*   true
*   false

Default value: false.', example='true'),
  updateColumns?: [ string ](name='UpdateColumns', description='Update columns, usually all non-primary key columns of the target table. When data duplication is determined through MatchColumns, updating the UpdateColumns column values will result in new data overwriting old data.'),
  writeMode?: string(name='WriteMode', description='The write mode.

Valid values:

*   MERGE
*   INSERT
*   UPDATE', example='INSERT/UPDATE/MERGE'),
}

model ModifyStreamingJobShrinkRequest {
  account?: string(name='Account', description='Account name.', example='test-account'),
  consistency?: string(name='Consistency', description='The delivery guarantee setting.', example='ATLEAST / EXACTLY'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID

This parameter is required.', example='ModifyStreamingJob'),
  destColumnsShrink?: string(name='DestColumns', description='Target data table mapping field list.'),
  destDatabase?: string(name='DestDatabase', description='Target database name.', example='dest-db'),
  destSchema?: string(name='DestSchema', description='Target schema.', example='dest-schema'),
  destTable?: string(name='DestTable', description='Target table name.', example='dest-table'),
  errorLimitCount?: long(name='ErrorLimitCount', description='When the data in Kafka does not match the ADBPG target table, it will cause a write failure. This value is the number of error rows allowed; exceeding this will cause the task to fail.', example='5'),
  fallbackOffset?: string(name='FallbackOffset', description='The fallback offset for data consumption.

*   This parameter specifies the starting offset from which data consumption resumes when a consumer does not request a consumption offset or requests a consumption offset that is beyond the range of the offset information recorded in the current Kafka cluster. You can choose to start data consumption from the earliest or latest offset.

Valid values:
*   EARLIEST
*   LATEST', example='EARLIEST /  LATEST'),
  groupName?: string(name='GroupName', description='Kafka group name', example='group_name'),
  jobConfig?: string(name='JobConfig', description='Job configuration file, required for professional mode.', example='DATABASE: adbpgss_test
USER: adbpgss_test
PASSWORD: adbpgssTest
HOST: gp-xxx-master.gpdb.rds-aliyun-pre.rds.aliyuncs.com
PORT: 5432
KAFKA:
  INPUT:
    SOURCE:
      BROKERS: broker1:9092,broker2:9092,broker3:9092
      TOPIC: testtopic
      FALLBACK_OFFSET: earliest
    KEY:
      COLUMNS:
      - NAME: customer_id
        TYPE: int
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    VALUE:
      COLUMNS:
      - TYPE: integer
        NAME: l_orderkey
      - TYPE: integer
        NAME: l_partkey
      - TYPE: integer
        NAME: l_suppkey
      - TYPE: integer
        NAME: l_linenumber
      - TYPE: decimal
        NAME: l_quantity
      - TYPE: decimal
        NAME: l_extendedprice
      - TYPE: decimal
        NAME: l_discount
      - TYPE: decimal
        NAME: l_tax
      - TYPE: char
        NAME: l_returnflag
      - TYPE: char
        NAME: l_linestatus
      - TYPE: date
        NAME: l_shipdate
      - TYPE: date
        NAME: l_commitdate
      - TYPE: date
        NAME: l_receiptdate
      - TYPE: text
        NAME: l_shipinstruct
      - TYPE: text
        NAME: l_shipmode
      - TYPE: text
        NAME: l_comment
      FORMAT: delimited
      DELIMITED_OPTION:
        DELIMITER: \\\\"|\\\\"
    ERROR_LIMIT: 10
  OUTPUT:
    SCHEMA: adbpgss_test
    TABLE: write_with_insert_plaintext
    MODE: MERGE
    MATCH_COLUMNS:
    - l_orderkey
    - l_partkey
    - l_suppkey
    UPDATE_COLUMNS:
    - l_linenumber
    - l_quantity
    - l_extendedprice
    - l_discount
    - l_tax
    - l_returnflag
    - l_linestatus
    - l_shipdate
    - l_commitdate
    - l_receiptdate
    - l_shipinstruct
    - l_shipmode
    - l_comment
    MAPPING:
    - EXPRESSION: l_orderkey
      NAME: l_orderkey
    - EXPRESSION: l_partkey
      NAME: l_partkey
    - EXPRESSION: l_suppkey
      NAME: l_suppkey
    - EXPRESSION: l_linenumber
      NAME: l_linenumber
    - EXPRESSION: l_quantity
      NAME: l_quantity
    - EXPRESSION: l_extendedprice
      NAME: l_extendedprice
    - EXPRESSION: l_discount
      NAME: l_discount
    - EXPRESSION: l_tax
      NAME: l_tax
    - EXPRESSION: l_returnflag
      NAME: l_returnflag
    - EXPRESSION: l_linestatus
      NAME: l_linestatus
    - EXPRESSION: l_shipdate
      NAME: l_shipdate
    - EXPRESSION: l_commitdate
      NAME: l_commitdate
    - EXPRESSION: l_receiptdate
      NAME: l_receiptdate
    - EXPRESSION: l_shipinstruct
      NAME: l_shipinstruct
    - EXPRESSION: l_shipmode
      NAME: l_shipmode
    - EXPRESSION: l_comment
      NAME: l_comment
  COMMIT:
    MAX_ROW: 1000
    MINIMAL_INTERVAL: 1000
    CONSISTENCY: ATLEAST
  POLL:
    BATCHSIZE: 1000
    TIMEOUT: 1000
  PROPERTIES:
    group.id: testgroup'),
  jobDescription?: string(name='JobDescription', description='Job description.', example='test-job'),
  jobId?: long(name='JobId', description='Job ID.

This parameter is required.', example='1'),
  matchColumnsShrink?: string(name='MatchColumns', description='Match columns, usually all primary key columns of the target table. If all column values in this configuration are the same, the two rows of data are considered duplicates.'),
  password?: string(name='Password', description='Password.', example='pwd123'),
  regionId?: string(name='RegionId', description='Region ID.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) API to view available region IDs.', example='cn-beijing'),
  srcColumnsShrink?: string(name='SrcColumns', description='Source data field list.'),
  tryRun?: boolean(name='TryRun', description='Specifies whether to test the real-time job. Valid values:

*   true
*   false

Default value: false.', example='true'),
  updateColumnsShrink?: string(name='UpdateColumns', description='Update columns, usually all non-primary key columns of the target table. When data duplication is determined through MatchColumns, updating the UpdateColumns column values will result in new data overwriting old data.'),
  writeMode?: string(name='WriteMode', description='The write mode.

Valid values:

*   MERGE
*   INSERT
*   UPDATE', example='INSERT/UPDATE/MERGE'),
}

model ModifyStreamingJobResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='B4CAF581-2AC7-41AD-8940-D56DF7AADF5B'),
}

model ModifyStreamingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyStreamingJobResponseBody(name='body'),
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param tmpReq ModifyStreamingJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyStreamingJobResponse
 */
async function modifyStreamingJobWithOptions(tmpReq: ModifyStreamingJobRequest, runtime: Util.RuntimeOptions): ModifyStreamingJobResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyStreamingJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.destColumns)) {
    request.destColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.destColumns, 'DestColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.matchColumns)) {
    request.matchColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.matchColumns, 'MatchColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.srcColumns)) {
    request.srcColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.srcColumns, 'SrcColumns', 'json');
  }
  if (!Util.isUnset(tmpReq.updateColumns)) {
    request.updateColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.updateColumns, 'UpdateColumns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.account)) {
    query['Account'] = request.account;
  }
  if (!Util.isUnset(request.consistency)) {
    query['Consistency'] = request.consistency;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.destColumnsShrink)) {
    query['DestColumns'] = request.destColumnsShrink;
  }
  if (!Util.isUnset(request.destDatabase)) {
    query['DestDatabase'] = request.destDatabase;
  }
  if (!Util.isUnset(request.destSchema)) {
    query['DestSchema'] = request.destSchema;
  }
  if (!Util.isUnset(request.destTable)) {
    query['DestTable'] = request.destTable;
  }
  if (!Util.isUnset(request.errorLimitCount)) {
    query['ErrorLimitCount'] = request.errorLimitCount;
  }
  if (!Util.isUnset(request.fallbackOffset)) {
    query['FallbackOffset'] = request.fallbackOffset;
  }
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.jobConfig)) {
    query['JobConfig'] = request.jobConfig;
  }
  if (!Util.isUnset(request.jobDescription)) {
    query['JobDescription'] = request.jobDescription;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.matchColumnsShrink)) {
    query['MatchColumns'] = request.matchColumnsShrink;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.srcColumnsShrink)) {
    query['SrcColumns'] = request.srcColumnsShrink;
  }
  if (!Util.isUnset(request.tryRun)) {
    query['TryRun'] = request.tryRun;
  }
  if (!Util.isUnset(request.updateColumnsShrink)) {
    query['UpdateColumns'] = request.updateColumnsShrink;
  }
  if (!Util.isUnset(request.writeMode)) {
    query['WriteMode'] = request.writeMode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyStreamingJob',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Create External Data Source Configuration
 *
 * @param request ModifyStreamingJobRequest
 * @return ModifyStreamingJobResponse
 */
async function modifyStreamingJob(request: ModifyStreamingJobRequest): ModifyStreamingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyStreamingJobWithOptions(request, runtime);
}

model ModifyVectorConfigurationRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a region.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  vectorConfigurationStatus?: string(name='VectorConfigurationStatus', description='Specifies whether to enable vector engine optimization. Valid values:

*   **enabled**
*   **disabled**

> *   We recommend that you **do not enable** vector engine optimization in mainstream analysis and real-time data warehousing scenarios.
> *   We recommend that you **enable** vector engine optimization in AI Generated Content (AIGC) and vector retrieval scenarios that require the vector analysis engine.', example='enabled'),
}

model ModifyVectorConfigurationResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message that is returned.

This parameter is returned only if the request fails.', example='Failed to modify vector configuration.'),
  requestId?: string(name='RequestId', description='The request ID.', example='107BE202-D1A2-479E-98E0-A8**********'),
  status?: boolean(name='Status', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ModifyVectorConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyVectorConfigurationResponseBody(name='body'),
}

/**
 * @summary Modifies the vector engine optimization configuration of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyVectorConfigurationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyVectorConfigurationResponse
 */
async function modifyVectorConfigurationWithOptions(request: ModifyVectorConfigurationRequest, runtime: Util.RuntimeOptions): ModifyVectorConfigurationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.vectorConfigurationStatus)) {
    query['VectorConfigurationStatus'] = request.vectorConfigurationStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyVectorConfiguration',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the vector engine optimization configuration of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ModifyVectorConfigurationRequest
 * @return ModifyVectorConfigurationResponse
 */
async function modifyVectorConfiguration(request: ModifyVectorConfigurationRequest): ModifyVectorConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyVectorConfigurationWithOptions(request, runtime);
}

model PauseDataRedistributeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The cluster ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model PauseDataRedistributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model PauseDataRedistributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PauseDataRedistributeResponseBody(name='body'),
}

/**
 * @summary Pauses data redistribution.
 *
 * @param request PauseDataRedistributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PauseDataRedistributeResponse
 */
async function pauseDataRedistributeWithOptions(request: PauseDataRedistributeRequest, runtime: Util.RuntimeOptions): PauseDataRedistributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PauseDataRedistribute',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Pauses data redistribution.
 *
 * @param request PauseDataRedistributeRequest
 * @return PauseDataRedistributeResponse
 */
async function pauseDataRedistribute(request: PauseDataRedistributeRequest): PauseDataRedistributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return pauseDataRedistributeWithOptions(request, runtime);
}

model PauseInstanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model PauseInstanceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only if **false** is returned for the **Status** parameter.', example='*******'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34b32a0a-08ef-4a87-b6be-cdd9********'),
  status?: boolean(name='Status', description='Indicates whether the request was successful. Valid values:

*   **false**: The request failed.
*   **true**: The request was successful.', example='true'),
}

model PauseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PauseInstanceResponseBody(name='body'),
}

/**
 * @summary Pauses an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to pause an AnalyticDB for PostgreSQL instance that is in the **Running** state.
 * This operation is available only for AnalyticDB for PostgreSQL instances in Serverless mode that run V1.0.2.1 or later. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * >  Before you call this operation, make sure that you are familiar with the billing methods and pricing of AnalyticDB for PostgreSQL instances. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request PauseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PauseInstanceResponse
 */
async function pauseInstanceWithOptions(request: PauseInstanceRequest, runtime: Util.RuntimeOptions): PauseInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PauseInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Pauses an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to pause an AnalyticDB for PostgreSQL instance that is in the **Running** state.
 * This operation is available only for AnalyticDB for PostgreSQL instances in Serverless mode that run V1.0.2.1 or later. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * >  Before you call this operation, make sure that you are familiar with the billing methods and pricing of AnalyticDB for PostgreSQL instances. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request PauseInstanceRequest
 * @return PauseInstanceResponse
 */
async function pauseInstance(request: PauseInstanceRequest): PauseInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return pauseInstanceWithOptions(request, runtime);
}

model QueryCollectionDataRequest {
  collection?: string(name='Collection', description='Collection name.

> You can use the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) API to view the list.

This parameter is required.', example='document'),
  content?: string(name='Content', description='Content for full-text search. When this value is empty, only vector search is used; when it is not empty, both vector and full-text search are used.

> The Vector parameter cannot be empty at the same time.', example='hello_world'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.', example='gp-xxxxxxxxx'),
  filter?: string(name='Filter'),
  hybridSearch?: string(name='HybridSearch', description='Dual-path recall algorithm, default is empty (i.e., directly compare and sort the scores of vectors and full-text).

Available values:

- RRF: Reciprocal rank fusion, with a parameter k controlling the fusion effect. See HybridSearchArgs configuration for details;
- Weight: Weighted sorting, using a parameter alpha to control the score ratio of vectors and full-text, then sorting. See HybridSearchArgs configuration for details;
- Cascaded: Perform full-text search first, then vector search based on the full-text results;', example='RRF'),
  hybridSearchArgs?: map[string]object(name='HybridSearchArgs', description='The parameters of the two-way retrieval algorithm. The following parameters are supported:

*   When HybridSearch is set to RRF, the scores are calculated by using the `1/(k+rank_i)` formula. The constant k is a positive integer that is greater than 1.

<!---->

    { 
       "RRF": {
        "k": 60
       }
    }

*   When HybridSearch is set to Weight, the scores are calculated by using the `alpha * vector_score + (1-alpha) * text_score` formula. The alpha parameter specifies the proportion of the vector search score and the full-text search score and ranges from 0 to 1. A value of 0 specifies full-text search and a value of 1 specifies vector search.

<!---->

    { 
       "Weight": {
        "alpha": 0.5
       }
    }'),
  includeMetadataFields?: string(name='IncludeMetadataFields', description='Defaults to empty, indicating the metadata fields to return. Multiple fields should be separated by commas.', example='title,content'),
  includeValues?: boolean(name='IncludeValues', description='Whether to return vector data. Value descriptions:
- **true**: Return vector data.
- **false**: Do not return vector data, used for full-text search scenarios.', example='true'),
  metrics?: string(name='Metrics', description='Similarity algorithm used during retrieval. Value descriptions:
- **l2**: Euclidean distance.
- **ip**: Inner product (dot product) distance.
- **cosine**: Cosine similarity.

> If this value is empty, the algorithm specified during index creation is used.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace.

> You can use the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API to view the list.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

This parameter is required.', example='testpassword'),
  offset?: int32(name='Offset', description='Defaults to empty, indicating the starting point for pagination queries. Does not support hybrid search scenarios.

The value must be >= 0. When this value is not empty, it will return `Total`, which indicates the total number of hits. This parameter works with `TopK`. For example, to paginate 20 and retrieve chunks with `chunk_id` from 0 to 44, you need to make three requests:
- `Offset=0, TopK=20` returns `chunk_id` 0~19
- `Offset=20, TopK=20` returns `chunk_id` 20~39
- `Offset=30, TopK=20` returns `chunk_id` 40~44', example='0'),
  orderBy?: string(name='OrderBy', description='Defaults to empty, indicating the field for sorting. Does not support hybrid search scenarios.

The field must belong to metadata or be a default field in the table, such as `id`. The supported formats are:
- A single field, e.g., `chunk_id`;
- Multiple fields, separated by commas, e.g., `block_id, chunk_id`;
- Supports reverse order, e.g., `block_id DESC, chunk_id DESC`;', example='chunk_id'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  relationalTableFilter?: {
    collectionMetadataField?: string(name='CollectionMetadataField', description='The Metadata field of the vector collection, used to associate with the fields in the vector table.', example='doc_id'),
    condition?: string(name='Condition', description='The filtering condition for the relational table.', example='tags @> ARRAY[\\\\"art\\\\"]'),
    tableField?: string(name='TableField', description='The field in the relational table, used to associate with the Metadata field of the vector collection.', example='id'),
    tableName?: string(name='TableName', description='The name of the relational table.', example='my_rds_table'),
  }(name='RelationalTableFilter', description='Uses another relational table to filter vector data (similar to a Join function).

> Data from the relational table can be returned by setting the `IncludeMetadataFields` parameter. For example, `rds_table_name.id` indicates returning the `id` field from the relational table.'),
  sparseVector?: {
    indices?: [ long ](name='Indices'),
    values?: [ double ](name='Values'),
  }(name='SparseVector'),
  topK?: long(name='TopK', description='Set the number of top results to return.

This parameter is required.', example='10'),
  vector?: [ double ](name='Vector', description='Vector data, with the same dimension as specified in the [CreateCollection](https://help.aliyun.com/document_detail/2401497.html) API.
> When the vector is empty, only full-text search results are returned.'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the Workspace composed of multiple database instances. This parameter and `DBInstanceId` cannot both be empty. If both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model QueryCollectionDataShrinkRequest {
  collection?: string(name='Collection', description='Collection name.

> You can use the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) API to view the list.

This parameter is required.', example='document'),
  content?: string(name='Content', description='Content for full-text search. When this value is empty, only vector search is used; when it is not empty, both vector and full-text search are used.

> The Vector parameter cannot be empty at the same time.', example='hello_world'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.', example='gp-xxxxxxxxx'),
  filter?: string(name='Filter'),
  hybridSearch?: string(name='HybridSearch', description='Dual-path recall algorithm, default is empty (i.e., directly compare and sort the scores of vectors and full-text).

Available values:

- RRF: Reciprocal rank fusion, with a parameter k controlling the fusion effect. See HybridSearchArgs configuration for details;
- Weight: Weighted sorting, using a parameter alpha to control the score ratio of vectors and full-text, then sorting. See HybridSearchArgs configuration for details;
- Cascaded: Perform full-text search first, then vector search based on the full-text results;', example='RRF'),
  hybridSearchArgsShrink?: string(name='HybridSearchArgs', description='The parameters of the two-way retrieval algorithm. The following parameters are supported:

*   When HybridSearch is set to RRF, the scores are calculated by using the `1/(k+rank_i)` formula. The constant k is a positive integer that is greater than 1.

<!---->

    { 
       "RRF": {
        "k": 60
       }
    }

*   When HybridSearch is set to Weight, the scores are calculated by using the `alpha * vector_score + (1-alpha) * text_score` formula. The alpha parameter specifies the proportion of the vector search score and the full-text search score and ranges from 0 to 1. A value of 0 specifies full-text search and a value of 1 specifies vector search.

<!---->

    { 
       "Weight": {
        "alpha": 0.5
       }
    }'),
  includeMetadataFields?: string(name='IncludeMetadataFields', description='Defaults to empty, indicating the metadata fields to return. Multiple fields should be separated by commas.', example='title,content'),
  includeValues?: boolean(name='IncludeValues', description='Whether to return vector data. Value descriptions:
- **true**: Return vector data.
- **false**: Do not return vector data, used for full-text search scenarios.', example='true'),
  metrics?: string(name='Metrics', description='Similarity algorithm used during retrieval. Value descriptions:
- **l2**: Euclidean distance.
- **ip**: Inner product (dot product) distance.
- **cosine**: Cosine similarity.

> If this value is empty, the algorithm specified during index creation is used.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace.

> You can use the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API to view the list.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

This parameter is required.', example='testpassword'),
  offset?: int32(name='Offset', description='Defaults to empty, indicating the starting point for pagination queries. Does not support hybrid search scenarios.

The value must be >= 0. When this value is not empty, it will return `Total`, which indicates the total number of hits. This parameter works with `TopK`. For example, to paginate 20 and retrieve chunks with `chunk_id` from 0 to 44, you need to make three requests:
- `Offset=0, TopK=20` returns `chunk_id` 0~19
- `Offset=20, TopK=20` returns `chunk_id` 20~39
- `Offset=30, TopK=20` returns `chunk_id` 40~44', example='0'),
  orderBy?: string(name='OrderBy', description='Defaults to empty, indicating the field for sorting. Does not support hybrid search scenarios.

The field must belong to metadata or be a default field in the table, such as `id`. The supported formats are:
- A single field, e.g., `chunk_id`;
- Multiple fields, separated by commas, e.g., `block_id, chunk_id`;
- Supports reverse order, e.g., `block_id DESC, chunk_id DESC`;', example='chunk_id'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  relationalTableFilterShrink?: string(name='RelationalTableFilter', description='Uses another relational table to filter vector data (similar to a Join function).

> Data from the relational table can be returned by setting the `IncludeMetadataFields` parameter. For example, `rds_table_name.id` indicates returning the `id` field from the relational table.'),
  sparseVectorShrink?: string(name='SparseVector'),
  topK?: long(name='TopK', description='Set the number of top results to return.

This parameter is required.', example='10'),
  vectorShrink?: string(name='Vector', description='Vector data, with the same dimension as specified in the [CreateCollection](https://help.aliyun.com/document_detail/2401497.html) API.
> When the vector is empty, only full-text search results are returned.'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the Workspace composed of multiple database instances. This parameter and `DBInstanceId` cannot both be empty. If both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model QueryCollectionDataResponseBody = {
  matches?: {
    match?: [ 
    {
      id?: string(name='Id', description='The unique ID of the vector data.', example='doca-1234'),
      metadata?: map[string]string(name='Metadata', description='Metadata.'),
      score?: double(name='Score', description='The similarity score of this data, which is related to the algorithm `(l2/ip/cosine)` specified when creating the index.', example='0.12345'),
      values?: {
        value?: [ double ](name='value')
      }(name='Values', description='List of vector data.'),
    }
  ](name='match')
  }(name='Matches', description='Data list.'),
  message?: string(name='Message', description='Detailed information when the request fails.', example='0.1234'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Status, with the following values:
- **success**: Success.
- **fail**: Failure.', example='success'),
  total?: int32(name='Total', description='Only returned when the Offset is not 0, this value represents the total number of hits for the search criteria.', example='100'),
}

model QueryCollectionDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryCollectionDataResponseBody(name='body'),
}

/**
 * @summary Query Vector Data
 *
 * @param tmpReq QueryCollectionDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryCollectionDataResponse
 */
async function queryCollectionDataWithOptions(tmpReq: QueryCollectionDataRequest, runtime: Util.RuntimeOptions): QueryCollectionDataResponse {
  Util.validateModel(tmpReq);
  var request = new QueryCollectionDataShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.hybridSearchArgs)) {
    request.hybridSearchArgsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.hybridSearchArgs, 'HybridSearchArgs', 'json');
  }
  if (!Util.isUnset(tmpReq.relationalTableFilter)) {
    request.relationalTableFilterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.relationalTableFilter, 'RelationalTableFilter', 'json');
  }
  if (!Util.isUnset(tmpReq.sparseVector)) {
    request.sparseVectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sparseVector, 'SparseVector', 'json');
  }
  if (!Util.isUnset(tmpReq.vector)) {
    request.vectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.vector, 'Vector', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.hybridSearch)) {
    query['HybridSearch'] = request.hybridSearch;
  }
  if (!Util.isUnset(request.hybridSearchArgsShrink)) {
    query['HybridSearchArgs'] = request.hybridSearchArgsShrink;
  }
  if (!Util.isUnset(request.includeMetadataFields)) {
    query['IncludeMetadataFields'] = request.includeMetadataFields;
  }
  if (!Util.isUnset(request.includeValues)) {
    query['IncludeValues'] = request.includeValues;
  }
  if (!Util.isUnset(request.metrics)) {
    query['Metrics'] = request.metrics;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.offset)) {
    query['Offset'] = request.offset;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.relationalTableFilterShrink)) {
    query['RelationalTableFilter'] = request.relationalTableFilterShrink;
  }
  if (!Util.isUnset(request.sparseVectorShrink)) {
    query['SparseVector'] = request.sparseVectorShrink;
  }
  if (!Util.isUnset(request.topK)) {
    query['TopK'] = request.topK;
  }
  if (!Util.isUnset(request.vectorShrink)) {
    query['Vector'] = request.vectorShrink;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    body['Filter'] = request.filter;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryCollectionData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Query Vector Data
 *
 * @param request QueryCollectionDataRequest
 * @return QueryCollectionDataResponse
 */
async function queryCollectionData(request: QueryCollectionDataRequest): QueryCollectionDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCollectionDataWithOptions(request, runtime);
}

model QueryContentRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the list of created document collections.

This parameter is required.', example='document'),
  content?: string(name='Content'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='In image search scenarios, the source file name of the image to be searched.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='test.jpg'),
  fileUrl?: string(name='FileUrl', description='In image search scenarios, the publicly accessible URL of the image file.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='https://xx/myImage.jpg'),
  filter?: string(name='Filter', description='Filter condition for the data to be queried, in SQL WHERE format. It is an expression that returns a boolean value (true or false). The conditions can be simple comparison operators such as equal (=), not equal (<> or !=), greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), or more complex expressions combined with logical operators (AND, OR, NOT), and conditions using keywords like IN, BETWEEN, LIKE, etc.

> 
> - For detailed syntax, refer to: https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-where/', example='title = \\\\"test\\\\" AND name like \\\\"test%\\\\"'),
  hybridSearch?: string(name='HybridSearch', description='Dual recall algorithm, default is empty (i.e., directly compare and sort the scores of vectors and full text).

Available values:

- RRF: Reciprocal rank fusion, with a parameter k controlling the fusion effect. See HybridSearchArgs configuration for details;
- Weight: Weighted ranking, using a parameter alpha to control the weight of vector and full-text scores, then sorting. See HybridSearchArgs configuration for details;
- Cascaded: Perform full-text retrieval first, then vector retrieval on top of it;', example='RRF'),
  hybridSearchArgs?: map[string]object(name='HybridSearchArgs', description='The parameters of the two-way retrieval algorithm. The following parameters are supported:

*   When HybridSearch is set to RRF, the scores are calculated by using the `1/(k+rank_i)` formula. The constant k is a positive integer that is greater than 1.

<!---->

    { 
       "RRF": {
        "k": 60
       }
    }

*   When HybridSearch is set to Weight, the scores are calculated by using the `alpha * vector_score + (1-alpha) * text_score` formula. The alpha parameter specifies the proportion of the vector search score and the full-text search score and ranges from 0 to 1. A value of 0 specifies full-text search and a value of 1 specifies vector search.

<!---->

    { 
       "Weight": {
        "alpha": 0.5
       }
    }'),
  includeFileUrl?: boolean(name='IncludeFileUrl', description='Specifies whether to return the URL of the document. Default value: false.', example='false'),
  includeMetadataFields?: string(name='IncludeMetadataFields', description='The metadata fields to be returned. Separate multiple fields with commas (,). This parameter is empty by default.', example='title,page'),
  includeVector?: boolean(name='IncludeVector', description='Whether to return vectors. Default is false.
> - **false**: Do not return vectors.
> - **true**: Return vectors.', example='true'),
  metrics?: string(name='Metrics', description='Similarity algorithm used during retrieval. If this value is empty, the algorithm specified at the time of knowledge base creation is used. It is recommended not to set this unless there is a specific need.

> Value description:
> - **l2**: Euclidean distance.
> - **ip**: Inner product (dot product) distance.
> - **cosine**: Cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create a namespace using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list of namespaces using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified in the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  recallWindow?: [ int32 ](name='RecallWindow', description='Recall window. When this value is not empty, it adds context to the returned search results. The format is an array of 2 elements: List<A, B>, where -10 <= A <= 0 and 0 <= B <= 10.
> - Recommended when documents are fragmented and retrieval may lose contextual information.
> - Re-ranking takes precedence over windowing, i.e., re-rank first, then apply windowing.'),
  regionId?: string(name='RegionId', description='The region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  rerankFactor?: double(name='RerankFactor', description='Re-ranking factor. When this value is not empty, it will re-rank the vector search results. The value range is 1 < RerankFactor <= 5.
> - Re-ranking is slower when documents are sparsely split.
> - It is recommended that the re-ranked count (TopK * Factor, rounded up) does not exceed 50.', example='2'),
  topK?: int32(name='TopK', description='Set the number of top results to return.', example='10'),
  useFullTextRetrieval?: boolean(name='UseFullTextRetrieval', description='Whether to use full-text retrieval (dual recall). Default is false, which means only vector retrieval is used.', example='true'),
}

model QueryContentAdvanceRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the list of created document collections.

This parameter is required.', example='document'),
  content?: string(name='Content'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='In image search scenarios, the source file name of the image to be searched.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='test.jpg'),
  fileUrlObject?: readable(name='FileUrl', description='In image search scenarios, the publicly accessible URL of the image file.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='https://xx/myImage.jpg'),
  filter?: string(name='Filter', description='Filter condition for the data to be queried, in SQL WHERE format. It is an expression that returns a boolean value (true or false). The conditions can be simple comparison operators such as equal (=), not equal (<> or !=), greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), or more complex expressions combined with logical operators (AND, OR, NOT), and conditions using keywords like IN, BETWEEN, LIKE, etc.

> 
> - For detailed syntax, refer to: https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-where/', example='title = \\\\"test\\\\" AND name like \\\\"test%\\\\"'),
  hybridSearch?: string(name='HybridSearch', description='Dual recall algorithm, default is empty (i.e., directly compare and sort the scores of vectors and full text).

Available values:

- RRF: Reciprocal rank fusion, with a parameter k controlling the fusion effect. See HybridSearchArgs configuration for details;
- Weight: Weighted ranking, using a parameter alpha to control the weight of vector and full-text scores, then sorting. See HybridSearchArgs configuration for details;
- Cascaded: Perform full-text retrieval first, then vector retrieval on top of it;', example='RRF'),
  hybridSearchArgs?: map[string]object(name='HybridSearchArgs', description='The parameters of the two-way retrieval algorithm. The following parameters are supported:

*   When HybridSearch is set to RRF, the scores are calculated by using the `1/(k+rank_i)` formula. The constant k is a positive integer that is greater than 1.

<!---->

    { 
       "RRF": {
        "k": 60
       }
    }

*   When HybridSearch is set to Weight, the scores are calculated by using the `alpha * vector_score + (1-alpha) * text_score` formula. The alpha parameter specifies the proportion of the vector search score and the full-text search score and ranges from 0 to 1. A value of 0 specifies full-text search and a value of 1 specifies vector search.

<!---->

    { 
       "Weight": {
        "alpha": 0.5
       }
    }'),
  includeFileUrl?: boolean(name='IncludeFileUrl', description='Specifies whether to return the URL of the document. Default value: false.', example='false'),
  includeMetadataFields?: string(name='IncludeMetadataFields', description='The metadata fields to be returned. Separate multiple fields with commas (,). This parameter is empty by default.', example='title,page'),
  includeVector?: boolean(name='IncludeVector', description='Whether to return vectors. Default is false.
> - **false**: Do not return vectors.
> - **true**: Return vectors.', example='true'),
  metrics?: string(name='Metrics', description='Similarity algorithm used during retrieval. If this value is empty, the algorithm specified at the time of knowledge base creation is used. It is recommended not to set this unless there is a specific need.

> Value description:
> - **l2**: Euclidean distance.
> - **ip**: Inner product (dot product) distance.
> - **cosine**: Cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create a namespace using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list of namespaces using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified in the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  recallWindow?: [ int32 ](name='RecallWindow', description='Recall window. When this value is not empty, it adds context to the returned search results. The format is an array of 2 elements: List<A, B>, where -10 <= A <= 0 and 0 <= B <= 10.
> - Recommended when documents are fragmented and retrieval may lose contextual information.
> - Re-ranking takes precedence over windowing, i.e., re-rank first, then apply windowing.'),
  regionId?: string(name='RegionId', description='The region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  rerankFactor?: double(name='RerankFactor', description='Re-ranking factor. When this value is not empty, it will re-rank the vector search results. The value range is 1 < RerankFactor <= 5.
> - Re-ranking is slower when documents are sparsely split.
> - It is recommended that the re-ranked count (TopK * Factor, rounded up) does not exceed 50.', example='2'),
  topK?: int32(name='TopK', description='Set the number of top results to return.', example='10'),
  useFullTextRetrieval?: boolean(name='UseFullTextRetrieval', description='Whether to use full-text retrieval (dual recall). Default is false, which means only vector retrieval is used.', example='true'),
}

model QueryContentShrinkRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the list of created document collections.

This parameter is required.', example='document'),
  content?: string(name='Content'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='In image search scenarios, the source file name of the image to be searched.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='test.jpg'),
  fileUrl?: string(name='FileUrl', description='In image search scenarios, the publicly accessible URL of the image file.

> The image file must have a file extension. Currently supported image extensions: bmp, jpg, jpeg, png, tiff.', example='https://xx/myImage.jpg'),
  filter?: string(name='Filter', description='Filter condition for the data to be queried, in SQL WHERE format. It is an expression that returns a boolean value (true or false). The conditions can be simple comparison operators such as equal (=), not equal (<> or !=), greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), or more complex expressions combined with logical operators (AND, OR, NOT), and conditions using keywords like IN, BETWEEN, LIKE, etc.

> 
> - For detailed syntax, refer to: https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-where/', example='title = \\\\"test\\\\" AND name like \\\\"test%\\\\"'),
  hybridSearch?: string(name='HybridSearch', description='Dual recall algorithm, default is empty (i.e., directly compare and sort the scores of vectors and full text).

Available values:

- RRF: Reciprocal rank fusion, with a parameter k controlling the fusion effect. See HybridSearchArgs configuration for details;
- Weight: Weighted ranking, using a parameter alpha to control the weight of vector and full-text scores, then sorting. See HybridSearchArgs configuration for details;
- Cascaded: Perform full-text retrieval first, then vector retrieval on top of it;', example='RRF'),
  hybridSearchArgsShrink?: string(name='HybridSearchArgs', description='The parameters of the two-way retrieval algorithm. The following parameters are supported:

*   When HybridSearch is set to RRF, the scores are calculated by using the `1/(k+rank_i)` formula. The constant k is a positive integer that is greater than 1.

<!---->

    { 
       "RRF": {
        "k": 60
       }
    }

*   When HybridSearch is set to Weight, the scores are calculated by using the `alpha * vector_score + (1-alpha) * text_score` formula. The alpha parameter specifies the proportion of the vector search score and the full-text search score and ranges from 0 to 1. A value of 0 specifies full-text search and a value of 1 specifies vector search.

<!---->

    { 
       "Weight": {
        "alpha": 0.5
       }
    }'),
  includeFileUrl?: boolean(name='IncludeFileUrl', description='Specifies whether to return the URL of the document. Default value: false.', example='false'),
  includeMetadataFields?: string(name='IncludeMetadataFields', description='The metadata fields to be returned. Separate multiple fields with commas (,). This parameter is empty by default.', example='title,page'),
  includeVector?: boolean(name='IncludeVector', description='Whether to return vectors. Default is false.
> - **false**: Do not return vectors.
> - **true**: Return vectors.', example='true'),
  metrics?: string(name='Metrics', description='Similarity algorithm used during retrieval. If this value is empty, the algorithm specified at the time of knowledge base creation is used. It is recommended not to set this unless there is a specific need.

> Value description:
> - **l2**: Euclidean distance.
> - **ip**: Inner product (dot product) distance.
> - **cosine**: Cosine similarity.', example='cosine'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create a namespace using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list of namespaces using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password for the namespace.

> This value is specified in the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  recallWindowShrink?: string(name='RecallWindow', description='Recall window. When this value is not empty, it adds context to the returned search results. The format is an array of 2 elements: List<A, B>, where -10 <= A <= 0 and 0 <= B <= 10.
> - Recommended when documents are fragmented and retrieval may lose contextual information.
> - Re-ranking takes precedence over windowing, i.e., re-rank first, then apply windowing.'),
  regionId?: string(name='RegionId', description='The region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  rerankFactor?: double(name='RerankFactor', description='Re-ranking factor. When this value is not empty, it will re-rank the vector search results. The value range is 1 < RerankFactor <= 5.
> - Re-ranking is slower when documents are sparsely split.
> - It is recommended that the re-ranked count (TopK * Factor, rounded up) does not exceed 50.', example='2'),
  topK?: int32(name='TopK', description='Set the number of top results to return.', example='10'),
  useFullTextRetrieval?: boolean(name='UseFullTextRetrieval', description='Whether to use full-text retrieval (dual recall). Default is false, which means only vector retrieval is used.', example='true'),
}

model QueryContentResponseBody = {
  embeddingTokens?: string(name='EmbeddingTokens', description='Number of tokens used for vectorization.

> A token refers to the smallest unit into which the input text is divided; a token can be a word, a phrase, a punctuation mark, or a character, etc.', example='100'),
  matches?: {
    matchList?: [ 
    {
      content?: string(name='Content', description='The content that is used for full-text search. If you leave this parameter empty, only vector search is used. If you do not leave this parameter empty, two-way retrieval based on vector search and full-text search is used.

>  You must specify at least one of the Content and Vector parameters.', example='Cloud-native data warehouse AnalyticDB PostgreSQL Edition provides a simple, fast, and cost-effective PB-level cloud data warehouse solution.'),
      fileName?: string(name='FileName', description='The name of the document.

>  You can call the [ListDocuments](https://help.aliyun.com/document_detail/2618453.html) operation to query a list of documents.', example='my_doc.txt'),
      fileURL?: string(name='FileURL', description='The public URL of the query result image, valid for 2 hours', example='https://xxx-cn-beijing.aliyuncs.com/image/test.png'),
      id?: string(name='Id', description='The unique ID of the vector data.', example='doca-1234'),
      loaderMetadata?: string(name='LoaderMetadata', description='Metadata during document loader loading.', example='{"page_pos": 1}'),
      metadata?: map[string]string(name='Metadata', description='The metadata.'),
      rerankScore?: double(name='RerankScore', description='Re-ranking score.', example='6.2345'),
      retrievalSource?: int32(name='RetrievalSource', description='Source of the retrieval results:

- 1 indicates vector retrieval
- 2 indicates full-text retrieval
- 3 indicates dual-path recall', example='1'),
      score?: double(name='Score', description='The similarity score of the data. It is related to the `l2, ip, or cosine` algorithm that is specified when you create an index.', example='0.12345'),
      vector?: {
        vectorList?: [ double ](name='VectorList')
      }(name='Vector', description='The vector data. The length of the value must be the same as that of the Dimension parameter in the [CreateCollection](https://help.aliyun.com/document_detail/2401497.html) operation.

>  If you leave this parameter empty, only full-text search results are returned.'),
    }
  ](name='MatchList')
  }(name='Matches', description='The retrieved data.'),
  message?: string(name='Message', description='Return message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The execution state of the operation. Valid values:

*   **false**: The operation fails.
*   **true**: The operation is successful.', example='success'),
  usage?: {
    embeddingEntries?: string(name='EmbeddingEntries', description='The number of entries used for vectorization.
> An entry refers to the number of processing items when performing vectorization on text or images. For example, processing one piece of text counts as 1 entry, while processing one image counts as 2 entries.', example='10'),
    embeddingTokens?: string(name='EmbeddingTokens', description='Number of tokens used for vectorization.

> A token refers to the smallest unit into which the input text is divided; a token can be a word, a phrase, a punctuation mark, or a character, etc.', example='100'),
  }(name='Usage', description='Resource usage for this query.'),
  windowMatches?: {
    windowMatches?: [ 
    {
      windowMatch?: {
        windowMatch?: [ 
        {
          content?: string(name='Content', description='Text content.', example='AnalyticDB for PostgreSQL is a cloud-native data warehouse service that provides large-scale parallel processing (MPP) capabilities for massive online data analysis.'),
          fileName?: string(name='FileName', description='File name.', example='my_doc.txt'),
          id?: string(name='Id', description='Unique ID of the vector data.', example='doca-2345'),
          loaderMetadata?: string(name='LoaderMetadata', description='Metadata information when the document loader was loaded.', example='{"page_pos": 2}'),
          metadata?: map[string]string(name='Metadata', description='Metadata map.'),
        }
      ](name='windowMatch')
      }(name='WindowMatch', description='List of individual top windowed matches.'),
    }
  ](name='windowMatches')
  }(name='WindowMatches', description='List of windowed matches.'),
}

model QueryContentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryContentResponseBody(name='body'),
}

/**
 * @summary Query
 *
 * @param tmpReq QueryContentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryContentResponse
 */
async function queryContentWithOptions(tmpReq: QueryContentRequest, runtime: Util.RuntimeOptions): QueryContentResponse {
  Util.validateModel(tmpReq);
  var request = new QueryContentShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.hybridSearchArgs)) {
    request.hybridSearchArgsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.hybridSearchArgs, 'HybridSearchArgs', 'json');
  }
  if (!Util.isUnset(tmpReq.recallWindow)) {
    request.recallWindowShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.recallWindow, 'RecallWindow', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.hybridSearch)) {
    query['HybridSearch'] = request.hybridSearch;
  }
  if (!Util.isUnset(request.hybridSearchArgsShrink)) {
    query['HybridSearchArgs'] = request.hybridSearchArgsShrink;
  }
  if (!Util.isUnset(request.includeFileUrl)) {
    query['IncludeFileUrl'] = request.includeFileUrl;
  }
  if (!Util.isUnset(request.includeMetadataFields)) {
    query['IncludeMetadataFields'] = request.includeMetadataFields;
  }
  if (!Util.isUnset(request.includeVector)) {
    query['IncludeVector'] = request.includeVector;
  }
  if (!Util.isUnset(request.metrics)) {
    query['Metrics'] = request.metrics;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.recallWindowShrink)) {
    query['RecallWindow'] = request.recallWindowShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.rerankFactor)) {
    query['RerankFactor'] = request.rerankFactor;
  }
  if (!Util.isUnset(request.topK)) {
    query['TopK'] = request.topK;
  }
  if (!Util.isUnset(request.useFullTextRetrieval)) {
    query['UseFullTextRetrieval'] = request.useFullTextRetrieval;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryContent',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Query
 *
 * @param request QueryContentRequest
 * @return QueryContentResponse
 */
async function queryContent(request: QueryContentRequest): QueryContentResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryContentWithOptions(request, runtime);
}

async function queryContentAdvance(request: QueryContentAdvanceRequest, runtime: Util.RuntimeOptions): QueryContentResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'gpdb',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var queryContentReq = new QueryContentRequest{};
  OpenApiUtil.convert(request, queryContentReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    queryContentReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var queryContentResp = queryContentWithOptions(queryContentReq, runtime);
  return queryContentResp;
}

model RebalanceDBInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests.

The token can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/134212.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

This parameter is required.', example='gp-bp***************'),
}

model RebalanceDBInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='5414A4E5-4C36-4461-95FC-************'),
}

model RebalanceDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebalanceDBInstanceResponseBody(name='body'),
}

/**
 * @summary Rebalances an AnalyticDB for PostgreSQL instance.
 *
 * @param request RebalanceDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebalanceDBInstanceResponse
 */
async function rebalanceDBInstanceWithOptions(request: RebalanceDBInstanceRequest, runtime: Util.RuntimeOptions): RebalanceDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RebalanceDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Rebalances an AnalyticDB for PostgreSQL instance.
 *
 * @param request RebalanceDBInstanceRequest
 * @return RebalanceDBInstanceResponse
 */
async function rebalanceDBInstance(request: RebalanceDBInstanceRequest): RebalanceDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return rebalanceDBInstanceWithOptions(request, runtime);
}

model ReleaseInstancePublicConnectionRequest {
  addressType?: string(name='AddressType', description='The type of the endpoint. Default value: primary. Valid values:

*   **primary**: primary endpoint.
*   **cluster**: cluster endpoint. This type of endpoints can be created only for instances that have multiple coordinator nodes.', example='Intranet'),
  currentConnectionString?: string(name='CurrentConnectionString', description='The public endpoint of the instance.

You can log on to the AnalyticDB for PostgreSQL console and go to the **Basic Information** page of the instance to view the **public endpoint** in the **Database Connection** section.

This parameter is required.', example='gp-bp12ga6v69h86****.gpdb.rds.aliyuncs.com'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
}

model ReleaseInstancePublicConnectionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9CEF7037-4158-4A65-BEC7-2A**********'),
}

model ReleaseInstancePublicConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseInstancePublicConnectionResponseBody(name='body'),
}

/**
 * @summary Releases the public endpoint of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ReleaseInstancePublicConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseInstancePublicConnectionResponse
 */
async function releaseInstancePublicConnectionWithOptions(request: ReleaseInstancePublicConnectionRequest, runtime: Util.RuntimeOptions): ReleaseInstancePublicConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.currentConnectionString)) {
    query['CurrentConnectionString'] = request.currentConnectionString;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseInstancePublicConnection',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases the public endpoint of an AnalyticDB for PostgreSQL instance.
 *
 * @param request ReleaseInstancePublicConnectionRequest
 * @return ReleaseInstancePublicConnectionResponse
 */
async function releaseInstancePublicConnection(request: ReleaseInstancePublicConnectionRequest): ReleaseInstancePublicConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseInstancePublicConnectionWithOptions(request, runtime);
}

model RerankRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  documents?: [ string ](name='Documents', description='List of documents to be re-ordered.'),
  maxChunksPerDoc?: int32(name='MaxChunksPerDoc', description='Maximum number of chunks allowed when the text exceeds the model window:
- bge-reranker-v2-m3: default value is 10.
- bge-reranker-v2-minicpm-layerwise: default value is 5:

> Example of splitting
> - If using the bge-reranker-v2-minicpm-layerwise model, the maximum single inference window is 2048 tokens. If the query is 48 tokens and the content of a single document parameter is 9000 tokens, it will be divided as follows: 1-2000 for the first, 2001-4000 for the second, and so on. If the number of splits exceeds MaxChunksPerDoc, the remaining sentences will be discarded.', example='10'),
  model?: string(name='Model', description='Rerank model, currently supports:
- bge-reranker-v2-m3: (default), better performance, supports 8192 tokens per inference, if exceeded, it will be split, which may reduce the effect.
- bge-reranker-v2-minicpm-layerwise: better performance than v2-m3, supports 2048 tokens per inference, if exceeded, it will be split, which may reduce the effect.', example='bge-reranker-v2-m3'),
  ownerId?: long(name='OwnerId'),
  query?: string(name='Query', description='Query statement for Rerank.', example='What is ADBPG?'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  returnDocuments?: boolean(name='ReturnDocuments', description='If set to false, does not return the Documents text, only returns the index of the document order and the rerank score.', example='false'),
  topK?: int32(name='TopK', description='Number of most relevant documents to return.', example='3'),
}

model RerankShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  documentsShrink?: string(name='Documents', description='List of documents to be re-ordered.'),
  maxChunksPerDoc?: int32(name='MaxChunksPerDoc', description='Maximum number of chunks allowed when the text exceeds the model window:
- bge-reranker-v2-m3: default value is 10.
- bge-reranker-v2-minicpm-layerwise: default value is 5:

> Example of splitting
> - If using the bge-reranker-v2-minicpm-layerwise model, the maximum single inference window is 2048 tokens. If the query is 48 tokens and the content of a single document parameter is 9000 tokens, it will be divided as follows: 1-2000 for the first, 2001-4000 for the second, and so on. If the number of splits exceeds MaxChunksPerDoc, the remaining sentences will be discarded.', example='10'),
  model?: string(name='Model', description='Rerank model, currently supports:
- bge-reranker-v2-m3: (default), better performance, supports 8192 tokens per inference, if exceeded, it will be split, which may reduce the effect.
- bge-reranker-v2-minicpm-layerwise: better performance than v2-m3, supports 2048 tokens per inference, if exceeded, it will be split, which may reduce the effect.', example='bge-reranker-v2-m3'),
  ownerId?: long(name='OwnerId'),
  query?: string(name='Query', description='Query statement for Rerank.', example='What is ADBPG?'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  returnDocuments?: boolean(name='ReturnDocuments', description='If set to false, does not return the Documents text, only returns the index of the document order and the rerank score.', example='false'),
  topK?: int32(name='TopK', description='Number of most relevant documents to return.', example='3'),
}

model RerankResponseBody = {
  message?: string(name='Message', description='Detailed information returned by the interface.', example='success'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  results?: {
    results?: [ 
    {
      document?: string(name='Document', description='Re-ordered document information.', example='ADBPG is the OLAP database of Alibaba Cloud.'),
      index?: int32(name='Index', description='Index of this document in the request parameter Documents, starting from 0.', example='1'),
      relevanceScore?: float(name='RelevanceScore', description='Rerank similarity score.', example='2.31412'),
    }
  ](name='Results')
  }(name='Results', description='Rerank results.'),
  status?: string(name='Status', description='API execution status, value description:
- **success**: Execution succeeded.
- **fail**: Execution failed.', example='success'),
  tokens?: int32(name='Tokens', description='Number of consumed tokens.', example='100'),
}

model RerankResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RerankResponseBody(name='body'),
}

/**
 * @summary Score and re-order documents using a model
 *
 * @param tmpReq RerankRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RerankResponse
 */
async function rerankWithOptions(tmpReq: RerankRequest, runtime: Util.RuntimeOptions): RerankResponse {
  Util.validateModel(tmpReq);
  var request = new RerankShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.documents)) {
    request.documentsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.documents, 'Documents', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.documentsShrink)) {
    body['Documents'] = request.documentsShrink;
  }
  if (!Util.isUnset(request.maxChunksPerDoc)) {
    body['MaxChunksPerDoc'] = request.maxChunksPerDoc;
  }
  if (!Util.isUnset(request.model)) {
    body['Model'] = request.model;
  }
  if (!Util.isUnset(request.query)) {
    body['Query'] = request.query;
  }
  if (!Util.isUnset(request.returnDocuments)) {
    body['ReturnDocuments'] = request.returnDocuments;
  }
  if (!Util.isUnset(request.topK)) {
    body['TopK'] = request.topK;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Rerank',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Score and re-order documents using a model
 *
 * @param request RerankRequest
 * @return RerankResponse
 */
async function rerank(request: RerankRequest): RerankResponse {
  var runtime = new Util.RuntimeOptions{};
  return rerankWithOptions(request, runtime);
}

model ResetAccountPasswordRequest {
  accountName?: string(name='AccountName', description='The ID of the instance.

This parameter is required.', example='testaccount_1'),
  accountPassword?: string(name='AccountPassword', description='The name of the account.

This parameter is required.', example='Testaccount_1'),
  DBInstanceId?: string(name='DBInstanceId', description='Before you call this operation, make sure that the following requirements are met:

*   The instance is in the running state.
*   The instance is not locked.

This parameter is required.', example='gp-t4nf48vf15713****'),
}

model ResetAccountPasswordResponseBody = {
  requestId?: string(name='RequestId', description='The new password for the account. The password must be 8 to 32 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include `! @ # $ % ^ & * ( ) _ + - =`', example='187C80FC-75C4-477C-BBF2-A368A36D041C'),
}

model ResetAccountPasswordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetAccountPasswordResponseBody(name='body'),
}

/**
 * @summary Resets the password of a database account for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ResetAccountPasswordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetAccountPasswordResponse
 */
async function resetAccountPasswordWithOptions(request: ResetAccountPasswordRequest, runtime: Util.RuntimeOptions): ResetAccountPasswordResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.accountPassword)) {
    query['AccountPassword'] = request.accountPassword;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetAccountPassword',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Resets the password of a database account for an AnalyticDB for PostgreSQL instance.
 *
 * @param request ResetAccountPasswordRequest
 * @return ResetAccountPasswordResponse
 */
async function resetAccountPassword(request: ResetAccountPasswordRequest): ResetAccountPasswordResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetAccountPasswordWithOptions(request, runtime);
}

model ResetIMVMonitorDataRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-bp152460513z****'),
  database?: string(name='Database', description='The name of the database.

This parameter is required.', example='testdb'),
}

model ResetIMVMonitorDataResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: boolean(name='Status', description='Indicates whether the request was successful. Valid values:

*   **false**
*   **true**', example='true'),
}

model ResetIMVMonitorDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetIMVMonitorDataResponseBody(name='body'),
}

/**
 * @summary Resets the IMV statistics.
 *
 * @param request ResetIMVMonitorDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetIMVMonitorDataResponse
 */
async function resetIMVMonitorDataWithOptions(request: ResetIMVMonitorDataRequest, runtime: Util.RuntimeOptions): ResetIMVMonitorDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.database)) {
    query['Database'] = request.database;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetIMVMonitorData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Resets the IMV statistics.
 *
 * @param request ResetIMVMonitorDataRequest
 * @return ResetIMVMonitorDataResponse
 */
async function resetIMVMonitorData(request: ResetIMVMonitorDataRequest): ResetIMVMonitorDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetIMVMonitorDataWithOptions(request, runtime);
}

model RestartDBInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/327176.html).', example='0c593ea1-3bea-11e9-b96b-88**********'),
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
}

model RestartDBInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='A7356493-7141-4393-8951-CDA8AB5D67EC'),
}

model RestartDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartDBInstanceResponseBody(name='body'),
}

/**
 * @summary Restarts an AnalyticDB for PostgreSQL instance.
 *
 * @description A restart takes about 3 to 30 minutes. During the restart, services are unavailable. We recommend that you restart the instance during off-peak hours. After the instance is restarted and enters the running state, you can access the instance.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request RestartDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartDBInstanceResponse
 */
async function restartDBInstanceWithOptions(request: RestartDBInstanceRequest, runtime: Util.RuntimeOptions): RestartDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RestartDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Restarts an AnalyticDB for PostgreSQL instance.
 *
 * @description A restart takes about 3 to 30 minutes. During the restart, services are unavailable. We recommend that you restart the instance during off-peak hours. After the instance is restarted and enters the running state, you can access the instance.
 * ## Limit
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered and may affect your business. We recommend that you take note of the limit when you call this operation.
 *
 * @param request RestartDBInstanceRequest
 * @return RestartDBInstanceResponse
 */
async function restartDBInstance(request: RestartDBInstanceRequest): RestartDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return restartDBInstanceWithOptions(request, runtime);
}

model ResumeDataRedistributeRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
}

model ResumeDataRedistributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model ResumeDataRedistributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResumeDataRedistributeResponseBody(name='body'),
}

/**
 * @summary Resumes data redistribution.
 *
 * @param request ResumeDataRedistributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResumeDataRedistributeResponse
 */
async function resumeDataRedistributeWithOptions(request: ResumeDataRedistributeRequest, runtime: Util.RuntimeOptions): ResumeDataRedistributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResumeDataRedistribute',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Resumes data redistribution.
 *
 * @param request ResumeDataRedistributeRequest
 * @return ResumeDataRedistributeResponse
 */
async function resumeDataRedistribute(request: ResumeDataRedistributeRequest): ResumeDataRedistributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return resumeDataRedistributeWithOptions(request, runtime);
}

model ResumeInstanceRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model ResumeInstanceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only if **false** is returned for the **Status** parameter.', example='******'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34b32a0a-08ef-4a87-b6be-cdd9********'),
  status?: boolean(name='Status', description='Indicates whether the request was successful. Valid values:

*   **false**: The request failed.
*   **true**: The request was successful.', example='true'),
}

model ResumeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResumeInstanceResponseBody(name='body'),
}

/**
 * @summary Resumes an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to resume an AnalyticDB for PostgreSQL instance that is in the **Paused** state.
 * This operation is available only for AnalyticDB for PostgreSQL instances in Serverless mode that run V1.0.2.1 or later. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * >  Before you call this operation, make sure that you are familiar with the billing methods and pricing of AnalyticDB for PostgreSQL instances. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ResumeInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResumeInstanceResponse
 */
async function resumeInstanceWithOptions(request: ResumeInstanceRequest, runtime: Util.RuntimeOptions): ResumeInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResumeInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Resumes an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to resume an AnalyticDB for PostgreSQL instance that is in the **Paused** state.
 * This operation is available only for AnalyticDB for PostgreSQL instances in Serverless mode that run V1.0.2.1 or later. For more information about how to view and update the minor engine version of an instance, see [View the minor engine version](https://help.aliyun.com/document_detail/277424.html) and [Update the minor engine version](https://help.aliyun.com/document_detail/139271.html).
 * >  Before you call this operation, make sure that you are familiar with the billing methods and pricing of AnalyticDB for PostgreSQL instances. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ResumeInstanceRequest
 * @return ResumeInstanceResponse
 */
async function resumeInstance(request: ResumeInstanceRequest): ResumeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return resumeInstanceWithOptions(request, runtime);
}

model SetDBInstancePlanStatusRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  planId?: string(name='PlanId', description='The ID of the plan.

>  You can call the [DescribeDBInstancePlans](https://help.aliyun.com/document_detail/449398.html) operation to query the details of plans, including plan IDs.

This parameter is required.', example='1234'),
  planStatus?: string(name='PlanStatus', description='Specifies whether to enable or disable the plan. Valid values:

*   **disable**: disables the plan.
*   **enable**: enables the plan.

This parameter is required.', example='disable'),
}

model SetDBInstancePlanStatusResponseBody = {
  errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only when the operation fails.', example='****'),
  planId?: string(name='PlanId', description='The ID of the plan.', example='1234'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34b32a0a-08ef-4a87-b6be-cdd988888888'),
  status?: string(name='Status', description='The state of the operation.

If the operation is successful, **success** is returned. If the operation fails, this parameter is not returned.', example='success'),
}

model SetDBInstancePlanStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetDBInstancePlanStatusResponseBody(name='body'),
}

/**
 * @summary Enables or disables a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to enable or disable a specified plan. The plan management feature is supported only for AnalyticDB for PostgreSQL instances in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request SetDBInstancePlanStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetDBInstancePlanStatusResponse
 */
async function setDBInstancePlanStatusWithOptions(request: SetDBInstancePlanStatusRequest, runtime: Util.RuntimeOptions): SetDBInstancePlanStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.planStatus)) {
    query['PlanStatus'] = request.planStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetDBInstancePlanStatus',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to enable or disable a specified plan. The plan management feature is supported only for AnalyticDB for PostgreSQL instances in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request SetDBInstancePlanStatusRequest
 * @return SetDBInstancePlanStatusResponse
 */
async function setDBInstancePlanStatus(request: SetDBInstancePlanStatusRequest): SetDBInstancePlanStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return setDBInstancePlanStatusWithOptions(request, runtime);
}

model SetDataShareInstanceRequest {
  instanceList?: [ string ](name='InstanceList', description='The ID of the AnalyticDB for PostgreSQL instance in Serverless mode.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.'),
  operationType?: string(name='OperationType', description='Specifies whether to enable or disable data sharing. Valid values:

*   **add**: enables data sharing.
*   **remove**: disables data sharing.

This parameter is required.', example='add'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model SetDataShareInstanceShrinkRequest {
  instanceListShrink?: string(name='InstanceList', description='The ID of the AnalyticDB for PostgreSQL instance in Serverless mode.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.'),
  operationType?: string(name='OperationType', description='Specifies whether to enable or disable data sharing. Valid values:

*   **add**: enables data sharing.
*   **remove**: disables data sharing.

This parameter is required.', example='add'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model SetDataShareInstanceResponseBody = {
  errMessage?: string(name='ErrMessage', description='The error message returned if the operation fails.', example='error message'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B4CAF581-2AC7-41AD-8940-D5**********'),
  status?: string(name='Status', description='The state of the operation. Valid values:

*   **success**: The operation is successful.
*   **failed**: The operation fails.', example='success'),
}

model SetDataShareInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetDataShareInstanceResponseBody(name='body'),
}

/**
 * @summary Enables or disables data sharing for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is called to enable or disable data sharing for an AnalyticDB for PostgreSQL instance in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation.
 *
 * @param tmpReq SetDataShareInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetDataShareInstanceResponse
 */
async function setDataShareInstanceWithOptions(tmpReq: SetDataShareInstanceRequest, runtime: Util.RuntimeOptions): SetDataShareInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new SetDataShareInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceList)) {
    request.instanceListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceList, 'InstanceList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.instanceListShrink)) {
    query['InstanceList'] = request.instanceListShrink;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetDataShareInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables data sharing for an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is called to enable or disable data sharing for an AnalyticDB for PostgreSQL instance in Serverless mode.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation.
 *
 * @param request SetDataShareInstanceRequest
 * @return SetDataShareInstanceResponse
 */
async function setDataShareInstance(request: SetDataShareInstanceRequest): SetDataShareInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return setDataShareInstanceWithOptions(request, runtime);
}

model SwitchDBInstanceNetTypeRequest {
  connectionStringPrefix?: string(name='ConnectionStringPrefix', description='The prefix of the custom endpoint.

*   The prefix can contain lowercase letters, digits, and hyphens (-) and must start with a lowercase letter.
*   The prefix can be up to 30 characters in length.

This parameter is required.', example='test1234'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/2361776.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='rm-uf6wjk5xxxxxxx'),
  port?: string(name='Port', description='The port number.

This parameter is required.', example='3306'),
}

model SwitchDBInstanceNetTypeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='FA67B751-2A2D-470C-850B-D6B93699D35C'),
}

model SwitchDBInstanceNetTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SwitchDBInstanceNetTypeResponseBody(name='body'),
}

/**
 * @summary Switches between the internal and public endpoints of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not supported for AnalyticDB for PostgreSQL instances in elastic storage mode or Serverless mode.
 *
 * @param request SwitchDBInstanceNetTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SwitchDBInstanceNetTypeResponse
 */
async function switchDBInstanceNetTypeWithOptions(request: SwitchDBInstanceNetTypeRequest, runtime: Util.RuntimeOptions): SwitchDBInstanceNetTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.connectionStringPrefix)) {
    query['ConnectionStringPrefix'] = request.connectionStringPrefix;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SwitchDBInstanceNetType',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Switches between the internal and public endpoints of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not supported for AnalyticDB for PostgreSQL instances in elastic storage mode or Serverless mode.
 *
 * @param request SwitchDBInstanceNetTypeRequest
 * @return SwitchDBInstanceNetTypeResponse
 */
async function switchDBInstanceNetType(request: SwitchDBInstanceNetTypeRequest): SwitchDBInstanceNetTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return switchDBInstanceNetTypeWithOptions(request, runtime);
}

model TagResourcesRequest {
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the region. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query region IDs.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The ID of an instance. Valid values of N: 1 to 50.

This parameter is required.', example='gp-xxxxxxxxxx'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  resourceType?: string(name='ResourceType', description='The mode of the instance. Valid values:

*   `instance`: reserved storage mode
*   `ALIYUN::GPDB::INSTANCE`: elastic storage mode

This parameter is required.', example='instance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of a tag. Valid values of N: 1 to 20. This parameter value cannot be an empty string. A tag key can contain a maximum of 128 characters. It cannot start with `aliyun` or`  acs: ` and cannot contain `http://` or`  https:// `.

This parameter is required.', example='TestKey'),
      value?: string(name='Value', description='The value of a tag. Valid values of N: 1 to 20. This parameter value can be an empty string. A tag value can contain a maximum of 128 characters. It cannot start with `acs:` and cannot contain `http://` or `https://`.

This parameter is required.', example='TestValue'),
    }
  ](name='Tag', description='The list of tags.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='5414A4E5-4C36-4461-95FC-23**********'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Creates and adds tags to AnalyticDB for PostgreSQL instances.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates and adds tags to AnalyticDB for PostgreSQL instances.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model TextEmbeddingRequest {
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
  input?: [ string ](name='Input'),
  model?: string(name='Model', example='text-embedding-v2'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
}

model TextEmbeddingShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is required.', example='gp-xxxxxxxxx'),
  inputShrink?: string(name='Input'),
  model?: string(name='Model', example='text-embedding-v2'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
}

model TextEmbeddingResponseBody = {
  message?: string(name='Message', example='Successful'),
  requestId?: string(name='RequestId', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  results?: {
    results?: [ 
    {
      embedding?: {
        embedding?: [ double ](name='Embedding')
      }(name='Embedding'),
      index?: int32(name='Index', example='0'),
    }
  ](name='Results')
  }(name='Results'),
  status?: string(name='Status', example='success'),
  textTokens?: int32(name='TextTokens', example='1000'),
}

model TextEmbeddingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TextEmbeddingResponseBody(name='body'),
}

/**
 * @summary 通过模型对文本文档进行向量化
 *
 * @param tmpReq TextEmbeddingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TextEmbeddingResponse
 */
async function textEmbeddingWithOptions(tmpReq: TextEmbeddingRequest, runtime: Util.RuntimeOptions): TextEmbeddingResponse {
  Util.validateModel(tmpReq);
  var request = new TextEmbeddingShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'Input', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.inputShrink)) {
    body['Input'] = request.inputShrink;
  }
  if (!Util.isUnset(request.model)) {
    body['Model'] = request.model;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TextEmbedding',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 通过模型对文本文档进行向量化
 *
 * @param request TextEmbeddingRequest
 * @return TextEmbeddingResponse
 */
async function textEmbedding(request: TextEmbeddingRequest): TextEmbeddingResponse {
  var runtime = new Util.RuntimeOptions{};
  return textEmbeddingWithOptions(request, runtime);
}

model UnbindDBResourceGroupWithRoleRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
  roleList?: [ string ](name='RoleList', description='The roles.

This parameter is required.'),
}

model UnbindDBResourceGroupWithRoleShrinkRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  ownerId?: long(name='OwnerId'),
  resourceGroupName?: string(name='ResourceGroupName', description='The name of the resource group.

This parameter is required.', example='testgroup'),
  roleListShrink?: string(name='RoleList', description='The roles.

This parameter is required.'),
}

model UnbindDBResourceGroupWithRoleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model UnbindDBResourceGroupWithRoleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UnbindDBResourceGroupWithRoleResponseBody(name='body'),
}

/**
 * @summary Unbinds database roles from a resource group.
 *
 * @param tmpReq UnbindDBResourceGroupWithRoleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UnbindDBResourceGroupWithRoleResponse
 */
async function unbindDBResourceGroupWithRoleWithOptions(tmpReq: UnbindDBResourceGroupWithRoleRequest, runtime: Util.RuntimeOptions): UnbindDBResourceGroupWithRoleResponse {
  Util.validateModel(tmpReq);
  var request = new UnbindDBResourceGroupWithRoleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.roleList)) {
    request.roleListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.roleList, 'RoleList', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['ResourceGroupName'] = request.resourceGroupName;
  }
  if (!Util.isUnset(request.roleListShrink)) {
    query['RoleList'] = request.roleListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnbindDBResourceGroupWithRole',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Unbinds database roles from a resource group.
 *
 * @param request UnbindDBResourceGroupWithRoleRequest
 * @return UnbindDBResourceGroupWithRoleResponse
 */
async function unbindDBResourceGroupWithRole(request: UnbindDBResourceGroupWithRoleRequest): UnbindDBResourceGroupWithRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return unbindDBResourceGroupWithRoleWithOptions(request, runtime);
}

model UnloadSampleDataRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
}

model UnloadSampleDataResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned if an error occurs. This message does not affect the execution of the operation.', example='********'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4E42ABC3-4DBD-5343-9BCA-66B7D091311F_6914'),
  status?: boolean(name='Status', description='The execution state of the operation. Valid values:

*   **false**: The operation fails.
*   **true**: The operation is successful.', example='true'),
}

model UnloadSampleDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UnloadSampleDataResponseBody(name='body'),
}

/**
 * @summary Releases a sample dataset from an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to release a sample dataset from an AnalyticDB for PostgreSQL instance. You must have already loaded the sample dataset.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UnloadSampleDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UnloadSampleDataResponse
 */
async function unloadSampleDataWithOptions(request: UnloadSampleDataRequest, runtime: Util.RuntimeOptions): UnloadSampleDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnloadSampleData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a sample dataset from an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to release a sample dataset from an AnalyticDB for PostgreSQL instance. You must have already loaded the sample dataset.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UnloadSampleDataRequest
 * @return UnloadSampleDataResponse
 */
async function unloadSampleData(request: UnloadSampleDataRequest): UnloadSampleDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return unloadSampleDataWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Whether to untag all tags on the instance. This parameter is only effective when TagKey.N is not set in the request. The value range is:

- true
- false

Default value: false', example='false'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID, you can view available region IDs through the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) interface.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='Instance ID. N\\\\"s value range: 1~50

This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  resourceType?: string(name='ResourceType', description='Resource type. The value range is:
- `instance`: Reserved mode instance.
- `ALIYUN::GPDB::INSTANCE`: Elastic mode instance.

This parameter is required.', example='instance'),
  tagKey?: [ string ](name='TagKey', description='Resource tag key. N\\\\"s value range: 1~20'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='5414A4E5-4C36-4461-95FC-23757A20B5F8'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Remove resource tags
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Remove resource tags
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

model UpdateCollectionDataMetadataRequest {
  collection?: string(name='Collection', description='Collection name.

> You can use the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) API to view the list.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.', example='gp-j788ghhjjxxxx'),
  filter?: string(name='Filter', description='Filter condition for the data to be updated, in SQL WHERE format. This field cannot be empty at the same time as the Ids field.', example='business_value = \\\\"chat_file_1\\\\"'),
  ids?: [ string ](name='Ids', description='ID list of the data to be updated, i.e., the Row.Id specified when uploading the data. This field cannot be empty at the same time as the Filter field.'),
  metadata?: map[string]any(name='Metadata', description='Data to be updated, in a JSON string of MAP format. The key is the field name, and the value is the new data value.

This parameter is required.', example='{
      "title": "new title",
      "content": "new content"
}'),
  namespace?: string(name='Namespace', description='Namespace.

> You can use the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API to view the list.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password corresponding to the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='ID of the Workspace composed of multiple database instances. This parameter and the DBInstanceId parameter cannot both be empty. When both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model UpdateCollectionDataMetadataShrinkRequest {
  collection?: string(name='Collection', description='Collection name.

> You can use the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) API to view the list.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB for PostgreSQL instances in the target region, including the instance ID.', example='gp-j788ghhjjxxxx'),
  filter?: string(name='Filter', description='Filter condition for the data to be updated, in SQL WHERE format. This field cannot be empty at the same time as the Ids field.', example='business_value = \\\\"chat_file_1\\\\"'),
  idsShrink?: string(name='Ids', description='ID list of the data to be updated, i.e., the Row.Id specified when uploading the data. This field cannot be empty at the same time as the Filter field.'),
  metadataShrink?: string(name='Metadata', description='Data to be updated, in a JSON string of MAP format. The key is the field name, and the value is the new data value.

This parameter is required.', example='{
      "title": "new title",
      "content": "new content"
}'),
  namespace?: string(name='Namespace', description='Namespace.

> You can use the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API to view the list.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password corresponding to the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='ID of the Workspace composed of multiple database instances. This parameter and the DBInstanceId parameter cannot both be empty. When both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model UpdateCollectionDataMetadataResponseBody = {
  appliedRows?: long(name='AppliedRows', description='Number of effective entries.', example='10'),
  message?: string(name='Message', description='Detailed information when the request fails.', example='failed to connect database, detailMsg: getConnection fail::SQL State: 28P01, Error Code: 0, Error Message: FATAL: password'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Status, with the following values:

- **success**: Success.
- **fail**: Failure.', example='success'),
}

model UpdateCollectionDataMetadataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateCollectionDataMetadataResponseBody(name='body'),
}

/**
 * @summary Update Metadata of Collection Data
 *
 * @param tmpReq UpdateCollectionDataMetadataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateCollectionDataMetadataResponse
 */
async function updateCollectionDataMetadataWithOptions(tmpReq: UpdateCollectionDataMetadataRequest, runtime: Util.RuntimeOptions): UpdateCollectionDataMetadataResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateCollectionDataMetadataShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ids)) {
    request.idsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ids, 'Ids', 'json');
  }
  if (!Util.isUnset(tmpReq.metadata)) {
    request.metadataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.metadata, 'Metadata', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.idsShrink)) {
    query['Ids'] = request.idsShrink;
  }
  if (!Util.isUnset(request.metadataShrink)) {
    query['Metadata'] = request.metadataShrink;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateCollectionDataMetadata',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Update Metadata of Collection Data
 *
 * @param request UpdateCollectionDataMetadataRequest
 * @return UpdateCollectionDataMetadataResponse
 */
async function updateCollectionDataMetadata(request: UpdateCollectionDataMetadataRequest): UpdateCollectionDataMetadataResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateCollectionDataMetadataWithOptions(request, runtime);
}

model UpdateDBInstancePlanRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  ownerId?: long(name='OwnerId'),
  planConfig?: string(name='PlanConfig', description='The execution information of the plan. Specify the parameter in the JSON format. The parameter value varies based on the values of **PlanType** and **PlanScheduleType**. The following section describes the PlanConfig parameter.', example='{"pause":{"executeTime":"2022-08-30T16:00:00Z"}}'),
  planDesc?: string(name='PlanDesc', description='The description of the plan.', example='this is a test plan'),
  planEndDate?: string(name='PlanEndDate', description='The end time of the plan. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time must be in UTC. The end time must be later than the start time.

> 

*   This parameter must be specified only for **periodically executed** plans.

*   If you do not specify this parameter, the plan stops until the plan is deleted.', example='2023-04-17T23:00Z'),
  planId?: string(name='PlanId', description='The ID of the plan.

>  You can call the [DescribeDBInstancePlans](https://help.aliyun.com/document_detail/449398.html) operation to query the details of plans, including plan IDs.

This parameter is required.', example='1234'),
  planName?: string(name='PlanName', description='The name of the plan.', example='test-plan'),
  planStartDate?: string(name='PlanStartDate', description='The start time of the plan. Specify the time in the ISO 8601 standard in the *yyyy-MM-dd*T*HH:mm:ss*Z format. The time must be in UTC.

> 

*   This parameter must be specified only for **periodically executed** plans.

*   If you do not specify this parameter, the current time is used.', example='2022-04-17T23:00Z'),
}

model UpdateDBInstancePlanResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.', example='gp-bp12ga6v69h86****'),
  errorMessage?: string(name='ErrorMessage', description='The error message returned.

This parameter is returned only when the operation fails.', example='****'),
  planId?: string(name='PlanId', description='The ID of the plan.', example='1234'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='34b32a0a-08ef-4a87-b6be-cdd9f56fc3ad'),
  status?: string(name='Status', description='The state of the operation.

If the operation is successful, **success** is returned. If the operation fails, this parameter is not returned.', example='success'),
}

model UpdateDBInstancePlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDBInstancePlanResponseBody(name='body'),
}

/**
 * @summary Modifies a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to modify a plan for an AnalyticDB for PostgreSQL instance in Serverless mode. For example, you can modify a plan for periodically pausing and resuming an instance or scaling an instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateDBInstancePlanRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDBInstancePlanResponse
 */
async function updateDBInstancePlanWithOptions(request: UpdateDBInstancePlanRequest, runtime: Util.RuntimeOptions): UpdateDBInstancePlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.planConfig)) {
    query['PlanConfig'] = request.planConfig;
  }
  if (!Util.isUnset(request.planDesc)) {
    query['PlanDesc'] = request.planDesc;
  }
  if (!Util.isUnset(request.planEndDate)) {
    query['PlanEndDate'] = request.planEndDate;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.planName)) {
    query['PlanName'] = request.planName;
  }
  if (!Util.isUnset(request.planStartDate)) {
    query['PlanStartDate'] = request.planStartDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDBInstancePlan',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a plan for an AnalyticDB for PostgreSQL instance.
 *
 * @description You can call this operation to modify a plan for an AnalyticDB for PostgreSQL instance in Serverless mode. For example, you can modify a plan for periodically pausing and resuming an instance or scaling an instance.
 * ## Limits
 * You can call this operation up to 1,000 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateDBInstancePlanRequest
 * @return UpdateDBInstancePlanResponse
 */
async function updateDBInstancePlan(request: UpdateDBInstancePlanRequest): UpdateDBInstancePlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateDBInstancePlanWithOptions(request, runtime);
}

model UpgradeDBInstanceRequest {
  DBInstanceClass?: string(name='DBInstanceClass', description='This parameter is no longer used.', example='null'),
  DBInstanceGroupCount?: string(name='DBInstanceGroupCount', description='This parameter is no longer used.', example='null'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the IDs of all AnalyticDB for PostgreSQL instances within a region.

This parameter is required.', example='gp-rj***************'),
  instanceSpec?: string(name='InstanceSpec', description='The specifications of each compute node. For information about the supported specifications, see [Instance specifications](https://help.aliyun.com/document_detail/35406.html).

> This parameter is available only for instances in elastic storage mode.', example='4C16G'),
  masterNodeNum?: string(name='MasterNodeNum', description='This parameter is no longer used.', example='2'),
  ownerId?: long(name='OwnerId'),
  payType?: string(name='PayType', description='This parameter is no longer used.', example='null'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

> You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs. For information about how to obtain the ID of a resource group, see [View basic information of a resource group](https://help.aliyun.com/document_detail/151181.html).', example='rg-bp67acfmxazb4p****'),
  segDiskPerformanceLevel?: string(name='SegDiskPerformanceLevel', description='The performance level of Enterprise SSDs (ESSDs). Valid values:

*   **pl0**
*   **pl1**
*   **pl2**', example='pl1'),
  segNodeNum?: string(name='SegNodeNum', description='The number of compute nodes. The number of compute nodes varies based on the instance resource type and edition.

*   Valid values for High-availability Edition instances in elastic storage mode: 4 to 512, in 4 increments.
*   Valid values for High-performance Edition instances in elastic storage mode: 2 to 512, in 2 increments.
*   Valid values for instances in manual Serverless mode: 2 to 512, in 2 increments.', example='2'),
  segStorageType?: string(name='SegStorageType', description='The disk storage type of the instance after the change. The disk storage type can be changed only to ESSD. Set the value to **cloud_essd**.', example='cloud_essd'),
  storageSize?: string(name='StorageSize', description='The storage capacity of each compute node. Unit: GB. Valid values: 50 to 6000, in 50 increments.

>  This parameter is available only for instances in elastic storage mode.', example='100'),
  upgradeType?: long(name='UpgradeType', description='The type of the instance configuration change. Valid values:

*   **0** (default): changes the number of compute nodes.
*   **1**: changes the specifications and storage capacity of each compute node.
*   **2**: changes the number of coordinator nodes.
*   **3**: changes the disk storage type and ESSD performance level of the instance.

> 

*   The supported changes to compute node configurations vary based on the instance resource type. For more information, see the "Usage notes" section of the [Change compute node configurations](https://help.aliyun.com/document_detail/50956.html) topic.

*   After you specify a change type, only the corresponding parameters take effect. For example, if you set **UpgradeType** to 0, the parameter that is used to change the number of compute nodes takes effect, but the parameter that is used to change the number of coordinator nodes does not.
*   The number of coordinator nodes can be changed only on the China site (aliyun.com).
*   The disk storage type can be changed only from ultra disks to ESSDs.', example='0'),
}

model UpgradeDBInstanceResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.', example='gp-rj***************'),
  orderId?: string(name='OrderId', description='The order ID.', example='*********'),
  requestId?: string(name='RequestId', description='The request ID.', example='25C11EE5-B7E8-481A-A07C-BD**********'),
}

model UpgradeDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeDBInstanceResponseBody(name='body'),
}

/**
 * @summary Changes the configurations of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request UpgradeDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeDBInstanceResponse
 */
async function upgradeDBInstanceWithOptions(request: UpgradeDBInstanceRequest, runtime: Util.RuntimeOptions): UpgradeDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceClass)) {
    query['DBInstanceClass'] = request.DBInstanceClass;
  }
  if (!Util.isUnset(request.DBInstanceGroupCount)) {
    query['DBInstanceGroupCount'] = request.DBInstanceGroupCount;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.instanceSpec)) {
    query['InstanceSpec'] = request.instanceSpec;
  }
  if (!Util.isUnset(request.masterNodeNum)) {
    query['MasterNodeNum'] = request.masterNodeNum;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.segDiskPerformanceLevel)) {
    query['SegDiskPerformanceLevel'] = request.segDiskPerformanceLevel;
  }
  if (!Util.isUnset(request.segNodeNum)) {
    query['SegNodeNum'] = request.segNodeNum;
  }
  if (!Util.isUnset(request.segStorageType)) {
    query['SegStorageType'] = request.segStorageType;
  }
  if (!Util.isUnset(request.storageSize)) {
    query['StorageSize'] = request.storageSize;
  }
  if (!Util.isUnset(request.upgradeType)) {
    query['UpgradeType'] = request.upgradeType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeDBInstance',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the configurations of an AnalyticDB for PostgreSQL instance.
 *
 * @description This operation is not available for instances in reserved storage mode.
 * Before you call this operation, make sure that you are familiar with the billing of AnalyticDB for PostgreSQL. For more information, see [Billing methods](https://help.aliyun.com/document_detail/35406.html) and [AnalyticDB for PostgreSQL pricing](https://www.alibabacloud.com/zh/product/hybriddb-postgresql/pricing).
 *
 * @param request UpgradeDBInstanceRequest
 * @return UpgradeDBInstanceResponse
 */
async function upgradeDBInstance(request: UpgradeDBInstanceRequest): UpgradeDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeDBInstanceWithOptions(request, runtime);
}

model UpgradeDBVersionRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The ID of the instance.

This parameter is required.', example='gp-wz9kmr708m155j***'),
  majorVersion?: string(name='MajorVersion', description='This parameter is no longer used and does not need to be specified.', example='null'),
  minorVersion?: string(name='MinorVersion', description='The minor version of the instance.', example='6.3.6.1-202112012048'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  switchTime?: string(name='SwitchTime', description='This parameter is no longer used and does not need to be specified.', example='null'),
  switchTimeMode?: string(name='SwitchTimeMode', description='This parameter is no longer used and does not need to be specified.', example='null'),
}

model UpgradeDBVersionResponseBody = {
  DBInstanceId?: string(name='DBInstanceId', description='This parameter is no longer returned.', example='gp-wz9kmr708m155j***'),
  DBInstanceName?: string(name='DBInstanceName', description='The name of the instance.', example='gp-wz9kmr708m155j***'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='25C11EE5-B7E8-481A-A07C-BD619971A570'),
  taskId?: string(name='TaskId', description='The ID of the task.', example='101450956'),
}

model UpgradeDBVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeDBVersionResponseBody(name='body'),
}

/**
 * @summary Upgrades the minor version of an AnalyticDB for PostgreSQL instance.
 *
 * @param request UpgradeDBVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeDBVersionResponse
 */
async function upgradeDBVersionWithOptions(request: UpgradeDBVersionRequest, runtime: Util.RuntimeOptions): UpgradeDBVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.majorVersion)) {
    query['MajorVersion'] = request.majorVersion;
  }
  if (!Util.isUnset(request.minorVersion)) {
    query['MinorVersion'] = request.minorVersion;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.switchTime)) {
    query['SwitchTime'] = request.switchTime;
  }
  if (!Util.isUnset(request.switchTimeMode)) {
    query['SwitchTimeMode'] = request.switchTimeMode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeDBVersion',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Upgrades the minor version of an AnalyticDB for PostgreSQL instance.
 *
 * @param request UpgradeDBVersionRequest
 * @return UpgradeDBVersionResponse
 */
async function upgradeDBVersion(request: UpgradeDBVersionRequest): UpgradeDBVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeDBVersionWithOptions(request, runtime);
}

model UpgradeExtensionsRequest {
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.

This parameter is required.', example='gp-xxxxxxxxx'),
  databaseName?: string(name='DatabaseName', description='Database name.', example='test01'),
  extensions?: string(name='Extensions', description='The extensions that you want to update. Separate multiple extensions with commas (,).

This parameter is required.', example='citext,dblink'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
}

model UpgradeExtensionsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
}

model UpgradeExtensionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeExtensionsResponseBody(name='body'),
}

/**
 * @summary Updates extensions.
 *
 * @param request UpgradeExtensionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeExtensionsResponse
 */
async function upgradeExtensionsWithOptions(request: UpgradeExtensionsRequest, runtime: Util.RuntimeOptions): UpgradeExtensionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.databaseName)) {
    query['DatabaseName'] = request.databaseName;
  }
  if (!Util.isUnset(request.extensions)) {
    query['Extensions'] = request.extensions;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeExtensions',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates extensions.
 *
 * @param request UpgradeExtensionsRequest
 * @return UpgradeExtensionsResponse
 */
async function upgradeExtensions(request: UpgradeExtensionsRequest): UpgradeExtensionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeExtensionsWithOptions(request, runtime);
}

model UploadDocumentAsyncRequest {
  chunkOverlap?: int32(name='ChunkOverlap', description='The size of data that is overlapped between consecutive chunks. The maximum value of this parameter cannot be greater than the value of the ChunkSize parameter.

>  This parameter is used to prevent context missing that may occur due to data truncation. For example, when you upload a long text, you can retain specific overlapped text content between consecutive chunks to better understand the context.', example='50'),
  chunkSize?: int32(name='ChunkSize', description='Strategy for processing large data: the size of each chunk when the data is split into smaller parts. Maximum value is 2048.', example='250'),
  collection?: string(name='Collection', description='The name of the document library. 
> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the document libraries that have already been created.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID with vector engine optimization acceleration enabled. You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  documentLoaderName?: string(name='DocumentLoaderName', description='The name of the document loader. You do not need to specify this parameter. A document loader is automatically specified based on the file extension. Valid values:

*   UnstructuredHTMLLoader: `.html`
*   UnstructuredMarkdownLoader: `.md`
*   PyMuPDFLoader: `.pdf`
*   PyPDFLoader: `.pdf`
*   RapidOCRPDFLoader: `.pdf`
*   PDFWithImageRefLoader: `.pdf` (with the text-image association feature)
*   JSONLoader: `.json`
*   CSVLoader: `.csv`
*   RapidOCRLoader: `.png`, `.jpg`, `.jpeg`, and `.bmp`
*   UnstructuredFileLoader: `.eml`, `.msg`, `.rst`, `.txt`, `.docx`, `.epub`, `.odt`, `.pptx`, and `.tsv`', example='PyMuPDFLoader'),
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only document understanding and chunking, but not vectorization and storage. Default value: false.

>  You can set this parameter to true, check the chunking effect, and then perform optimization if needed.', example='false'),
  fileName?: string(name='FileName', description='The file name of the document.

> 

*   We recommend that you add an extension to the file name. Examples: `.json`, `.md`, and `.pdf`. If you do not add an extension, the default loader designed for unstructured data is used.

*   If an image file is involved, the file name must contain an extension. The following extensions are supported: `.bmp`, `.jpg`, `.jpeg`, `.png`, and `.tiff`.

*   You can use a compressed package to upload images. The package file name must contain an extension. Supported package file extensions: `.tar`, `.gz`, and `.zip`.

This parameter is required.', example='mydoc.txt'),
  fileUrl?: string(name='FileUrl', description='The URL of the publicly accessible document.
>  > - It is recommended to call this interface using the SDK, which provides a method called UploadDocumentAsyncAdvance for directly uploading local files. > - If the URL points to an image archive, the number of images in the archive should not exceed 100.

This parameter is required.', example='https://xx/mydoc.txt'),
  metadata?: map[string]any(name='Metadata', description='The metadata. The value of this parameter must be the same as the Metadata parameter that is specified when you call the CreateDocumentCollection operation.'),
  namespace?: string(name='Namespace', description='Namespace, default is public. You can create one through the CreateNamespace interface and view the list via the ListNamespaces interface.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password corresponding to the namespace.  > This value is specified by the CreateNamespace interface.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  separators?: [ string ](name='Separators', description='The separators that are used to split large amounts of data.

> 

*   This is an important parameter that determines the chunking effect. This parameter is related to the splitter that is specified by the TextSplitterName parameter.

*   In most cases, you do not need to specify this parameter. The server assigns separators based on the value of the TextSplitterName parameter.'),
  textSplitterName?: string(name='TextSplitterName', description='The name of the splitter. Valid values:

*   **ChineseRecursiveTextSplitter**: inherits from RecursiveCharacterTextSplitter, uses `["\\\\n\\\\n","\\\\n", "。|!|?", "\\\\.\\\\s|\\\\!\\\\s|\\\\?\\\\s", ";|;\\\\s", ",|,\\\\s"]` as separators by default, and uses regular expressions to match text.
*   **RecursiveCharacterTextSplitter**: uses `["\\\\n\\\\n", "\\\\n", " ", ""]` as separators by default. The splitter supports splitting code in languages such as `C++, Go, Java, JS, PHP, Proto, Python, RST, Ruby, Rust, Scala, Swift, Markdown, LaTeX, HTML, Sol, and C Sharp`.
*   **SpacyTextSplitter**: uses `\\\\n\\\\n` as separators by default and uses the en_core_web_sm model of spaCy. The splitter can obtain better splitting effect.
*   **MarkdownHeaderTextSplitter**: splits text in the `[("#", "head1"), ("##", "head2"), ("###", "head3"), ("####", "head4")]` format. The splitter is suitable for Markdown text.', example='ChineseRecursiveTextSplitter'),
  zhTitleEnhance?: boolean(name='ZhTitleEnhance', description='Specifies whether to enable title enhancement.

>  You can determine the title text, mark the text in the metadata, and then combine the text with the upper-level title to implement text enhancement.', example='false'),
}

model UploadDocumentAsyncAdvanceRequest {
  chunkOverlap?: int32(name='ChunkOverlap', description='The size of data that is overlapped between consecutive chunks. The maximum value of this parameter cannot be greater than the value of the ChunkSize parameter.

>  This parameter is used to prevent context missing that may occur due to data truncation. For example, when you upload a long text, you can retain specific overlapped text content between consecutive chunks to better understand the context.', example='50'),
  chunkSize?: int32(name='ChunkSize', description='Strategy for processing large data: the size of each chunk when the data is split into smaller parts. Maximum value is 2048.', example='250'),
  collection?: string(name='Collection', description='The name of the document library. 
> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the document libraries that have already been created.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID with vector engine optimization acceleration enabled. You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  documentLoaderName?: string(name='DocumentLoaderName', description='The name of the document loader. You do not need to specify this parameter. A document loader is automatically specified based on the file extension. Valid values:

*   UnstructuredHTMLLoader: `.html`
*   UnstructuredMarkdownLoader: `.md`
*   PyMuPDFLoader: `.pdf`
*   PyPDFLoader: `.pdf`
*   RapidOCRPDFLoader: `.pdf`
*   PDFWithImageRefLoader: `.pdf` (with the text-image association feature)
*   JSONLoader: `.json`
*   CSVLoader: `.csv`
*   RapidOCRLoader: `.png`, `.jpg`, `.jpeg`, and `.bmp`
*   UnstructuredFileLoader: `.eml`, `.msg`, `.rst`, `.txt`, `.docx`, `.epub`, `.odt`, `.pptx`, and `.tsv`', example='PyMuPDFLoader'),
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only document understanding and chunking, but not vectorization and storage. Default value: false.

>  You can set this parameter to true, check the chunking effect, and then perform optimization if needed.', example='false'),
  fileName?: string(name='FileName', description='The file name of the document.

> 

*   We recommend that you add an extension to the file name. Examples: `.json`, `.md`, and `.pdf`. If you do not add an extension, the default loader designed for unstructured data is used.

*   If an image file is involved, the file name must contain an extension. The following extensions are supported: `.bmp`, `.jpg`, `.jpeg`, `.png`, and `.tiff`.

*   You can use a compressed package to upload images. The package file name must contain an extension. Supported package file extensions: `.tar`, `.gz`, and `.zip`.

This parameter is required.', example='mydoc.txt'),
  fileUrlObject?: readable(name='FileUrl', description='The URL of the publicly accessible document.
>  > - It is recommended to call this interface using the SDK, which provides a method called UploadDocumentAsyncAdvance for directly uploading local files. > - If the URL points to an image archive, the number of images in the archive should not exceed 100.

This parameter is required.', example='https://xx/mydoc.txt'),
  metadata?: map[string]any(name='Metadata', description='The metadata. The value of this parameter must be the same as the Metadata parameter that is specified when you call the CreateDocumentCollection operation.'),
  namespace?: string(name='Namespace', description='Namespace, default is public. You can create one through the CreateNamespace interface and view the list via the ListNamespaces interface.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password corresponding to the namespace.  > This value is specified by the CreateNamespace interface.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  separators?: [ string ](name='Separators', description='The separators that are used to split large amounts of data.

> 

*   This is an important parameter that determines the chunking effect. This parameter is related to the splitter that is specified by the TextSplitterName parameter.

*   In most cases, you do not need to specify this parameter. The server assigns separators based on the value of the TextSplitterName parameter.'),
  textSplitterName?: string(name='TextSplitterName', description='The name of the splitter. Valid values:

*   **ChineseRecursiveTextSplitter**: inherits from RecursiveCharacterTextSplitter, uses `["\\\\n\\\\n","\\\\n", "。|!|?", "\\\\.\\\\s|\\\\!\\\\s|\\\\?\\\\s", ";|;\\\\s", ",|,\\\\s"]` as separators by default, and uses regular expressions to match text.
*   **RecursiveCharacterTextSplitter**: uses `["\\\\n\\\\n", "\\\\n", " ", ""]` as separators by default. The splitter supports splitting code in languages such as `C++, Go, Java, JS, PHP, Proto, Python, RST, Ruby, Rust, Scala, Swift, Markdown, LaTeX, HTML, Sol, and C Sharp`.
*   **SpacyTextSplitter**: uses `\\\\n\\\\n` as separators by default and uses the en_core_web_sm model of spaCy. The splitter can obtain better splitting effect.
*   **MarkdownHeaderTextSplitter**: splits text in the `[("#", "head1"), ("##", "head2"), ("###", "head3"), ("####", "head4")]` format. The splitter is suitable for Markdown text.', example='ChineseRecursiveTextSplitter'),
  zhTitleEnhance?: boolean(name='ZhTitleEnhance', description='Specifies whether to enable title enhancement.

>  You can determine the title text, mark the text in the metadata, and then combine the text with the upper-level title to implement text enhancement.', example='false'),
}

model UploadDocumentAsyncShrinkRequest {
  chunkOverlap?: int32(name='ChunkOverlap', description='The size of data that is overlapped between consecutive chunks. The maximum value of this parameter cannot be greater than the value of the ChunkSize parameter.

>  This parameter is used to prevent context missing that may occur due to data truncation. For example, when you upload a long text, you can retain specific overlapped text content between consecutive chunks to better understand the context.', example='50'),
  chunkSize?: int32(name='ChunkSize', description='Strategy for processing large data: the size of each chunk when the data is split into smaller parts. Maximum value is 2048.', example='250'),
  collection?: string(name='Collection', description='The name of the document library. 
> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can call the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the document libraries that have already been created.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID with vector engine optimization acceleration enabled. You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-bp12ga6v69h86****'),
  documentLoaderName?: string(name='DocumentLoaderName', description='The name of the document loader. You do not need to specify this parameter. A document loader is automatically specified based on the file extension. Valid values:

*   UnstructuredHTMLLoader: `.html`
*   UnstructuredMarkdownLoader: `.md`
*   PyMuPDFLoader: `.pdf`
*   PyPDFLoader: `.pdf`
*   RapidOCRPDFLoader: `.pdf`
*   PDFWithImageRefLoader: `.pdf` (with the text-image association feature)
*   JSONLoader: `.json`
*   CSVLoader: `.csv`
*   RapidOCRLoader: `.png`, `.jpg`, `.jpeg`, and `.bmp`
*   UnstructuredFileLoader: `.eml`, `.msg`, `.rst`, `.txt`, `.docx`, `.epub`, `.odt`, `.pptx`, and `.tsv`', example='PyMuPDFLoader'),
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only document understanding and chunking, but not vectorization and storage. Default value: false.

>  You can set this parameter to true, check the chunking effect, and then perform optimization if needed.', example='false'),
  fileName?: string(name='FileName', description='The file name of the document.

> 

*   We recommend that you add an extension to the file name. Examples: `.json`, `.md`, and `.pdf`. If you do not add an extension, the default loader designed for unstructured data is used.

*   If an image file is involved, the file name must contain an extension. The following extensions are supported: `.bmp`, `.jpg`, `.jpeg`, `.png`, and `.tiff`.

*   You can use a compressed package to upload images. The package file name must contain an extension. Supported package file extensions: `.tar`, `.gz`, and `.zip`.

This parameter is required.', example='mydoc.txt'),
  fileUrl?: string(name='FileUrl', description='The URL of the publicly accessible document.
>  > - It is recommended to call this interface using the SDK, which provides a method called UploadDocumentAsyncAdvance for directly uploading local files. > - If the URL points to an image archive, the number of images in the archive should not exceed 100.

This parameter is required.', example='https://xx/mydoc.txt'),
  metadataShrink?: string(name='Metadata', description='The metadata. The value of this parameter must be the same as the Metadata parameter that is specified when you call the CreateDocumentCollection operation.'),
  namespace?: string(name='Namespace', description='Namespace, default is public. You can create one through the CreateNamespace interface and view the list via the ListNamespaces interface.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password corresponding to the namespace.  > This value is specified by the CreateNamespace interface.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  separatorsShrink?: string(name='Separators', description='The separators that are used to split large amounts of data.

> 

*   This is an important parameter that determines the chunking effect. This parameter is related to the splitter that is specified by the TextSplitterName parameter.

*   In most cases, you do not need to specify this parameter. The server assigns separators based on the value of the TextSplitterName parameter.'),
  textSplitterName?: string(name='TextSplitterName', description='The name of the splitter. Valid values:

*   **ChineseRecursiveTextSplitter**: inherits from RecursiveCharacterTextSplitter, uses `["\\\\n\\\\n","\\\\n", "。|!|?", "\\\\.\\\\s|\\\\!\\\\s|\\\\?\\\\s", ";|;\\\\s", ",|,\\\\s"]` as separators by default, and uses regular expressions to match text.
*   **RecursiveCharacterTextSplitter**: uses `["\\\\n\\\\n", "\\\\n", " ", ""]` as separators by default. The splitter supports splitting code in languages such as `C++, Go, Java, JS, PHP, Proto, Python, RST, Ruby, Rust, Scala, Swift, Markdown, LaTeX, HTML, Sol, and C Sharp`.
*   **SpacyTextSplitter**: uses `\\\\n\\\\n` as separators by default and uses the en_core_web_sm model of spaCy. The splitter can obtain better splitting effect.
*   **MarkdownHeaderTextSplitter**: splits text in the `[("#", "head1"), ("##", "head2"), ("###", "head3"), ("####", "head4")]` format. The splitter is suitable for Markdown text.', example='ChineseRecursiveTextSplitter'),
  zhTitleEnhance?: boolean(name='ZhTitleEnhance', description='Specifies whether to enable title enhancement.

>  You can determine the title text, mark the text in the metadata, and then combine the text with the upper-level title to implement text enhancement.', example='false'),
}

model UploadDocumentAsyncResponseBody = {
  jobId?: string(name='JobId', description='The job ID.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='API execution status, with the following values:
- **success**: Execution succeeded.
- **fail**: Execution failed.', example='success'),
}

model UploadDocumentAsyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UploadDocumentAsyncResponseBody(name='body'),
}

/**
 * @summary Asynchronous Document Upload
 *
 * @description The server loads and chunks a document based on the file extension, performs vectorization by using the embedding model that is specified when you call the CreateDocumentCollection operation, and then writes the document to the specified document collection. This operation supports multi-modal embedding for various formats of text and images.
 * Related operations:
 * *   You can call the GetUploadDocumentJob operation to query the progress and result of a document upload job.
 * *   You can call the CancelUploadDocumentJob operation to cancel a document upload job.
 * > 
 * *   After a document upload request is submitted, the request is queued for processing. Up to 20 documents in the Pending and Running states can be processed within a Resource Access Management (RAM) user or Alibaba Cloud account.
 * *   A text document can be split into up to 100,000 chunks.
 * *   If a document collection uses the OnePeace model, each RAM user or Alibaba Cloud account can upload and query up to 10,000 images.
 *
 * @param tmpReq UploadDocumentAsyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UploadDocumentAsyncResponse
 */
async function uploadDocumentAsyncWithOptions(tmpReq: UploadDocumentAsyncRequest, runtime: Util.RuntimeOptions): UploadDocumentAsyncResponse {
  Util.validateModel(tmpReq);
  var request = new UploadDocumentAsyncShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.metadata)) {
    request.metadataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.metadata, 'Metadata', 'json');
  }
  if (!Util.isUnset(tmpReq.separators)) {
    request.separatorsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.separators, 'Separators', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.chunkOverlap)) {
    body['ChunkOverlap'] = request.chunkOverlap;
  }
  if (!Util.isUnset(request.chunkSize)) {
    body['ChunkSize'] = request.chunkSize;
  }
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.documentLoaderName)) {
    body['DocumentLoaderName'] = request.documentLoaderName;
  }
  if (!Util.isUnset(request.dryRun)) {
    body['DryRun'] = request.dryRun;
  }
  if (!Util.isUnset(request.fileName)) {
    body['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    body['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.metadataShrink)) {
    body['Metadata'] = request.metadataShrink;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.separatorsShrink)) {
    body['Separators'] = request.separatorsShrink;
  }
  if (!Util.isUnset(request.textSplitterName)) {
    body['TextSplitterName'] = request.textSplitterName;
  }
  if (!Util.isUnset(request.zhTitleEnhance)) {
    body['ZhTitleEnhance'] = request.zhTitleEnhance;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UploadDocumentAsync',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Asynchronous Document Upload
 *
 * @description The server loads and chunks a document based on the file extension, performs vectorization by using the embedding model that is specified when you call the CreateDocumentCollection operation, and then writes the document to the specified document collection. This operation supports multi-modal embedding for various formats of text and images.
 * Related operations:
 * *   You can call the GetUploadDocumentJob operation to query the progress and result of a document upload job.
 * *   You can call the CancelUploadDocumentJob operation to cancel a document upload job.
 * > 
 * *   After a document upload request is submitted, the request is queued for processing. Up to 20 documents in the Pending and Running states can be processed within a Resource Access Management (RAM) user or Alibaba Cloud account.
 * *   A text document can be split into up to 100,000 chunks.
 * *   If a document collection uses the OnePeace model, each RAM user or Alibaba Cloud account can upload and query up to 10,000 images.
 *
 * @param request UploadDocumentAsyncRequest
 * @return UploadDocumentAsyncResponse
 */
async function uploadDocumentAsync(request: UploadDocumentAsyncRequest): UploadDocumentAsyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return uploadDocumentAsyncWithOptions(request, runtime);
}

async function uploadDocumentAsyncAdvance(request: UploadDocumentAsyncAdvanceRequest, runtime: Util.RuntimeOptions): UploadDocumentAsyncResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'gpdb',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var uploadDocumentAsyncReq = new UploadDocumentAsyncRequest{};
  OpenApiUtil.convert(request, uploadDocumentAsyncReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    uploadDocumentAsyncReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var uploadDocumentAsyncResp = uploadDocumentAsyncWithOptions(uploadDocumentAsyncReq, runtime);
  return uploadDocumentAsyncResp;
}

model UpsertChunksRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the already created document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='File name.

> If a file name is specified and not empty, it will overwrite the data for this file name; if empty, the chunks data will be appended directly to the document collection.', example='mydoc.txt'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create it using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password corresponding to the namespace.

> This value is specified by the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  textChunks?: [ 
    {
      content?: string(name='Content', description='Document content.

This parameter is required.', example='Cloud-native data warehouse AnalyticDB PostgreSQL Edition provides a simple, fast, and cost-effective PB-level cloud data warehouse solution.'),
      metadata?: map[string]any(name='Metadata', description='Metadata.', example='{"title":"test"}'),
    }
  ](name='TextChunks', description='List of split documents.'),
}

model UpsertChunksShrinkRequest {
  collection?: string(name='Collection', description='Document collection name.

> Created by the [CreateDocumentCollection](https://help.aliyun.com/document_detail/2618448.html) API. You can use the [ListDocumentCollections](https://help.aliyun.com/document_detail/2618452.html) API to view the already created document collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='Instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

This parameter is required.', example='gp-xxxxxxxxx'),
  fileName?: string(name='FileName', description='File name.

> If a file name is specified and not empty, it will overwrite the data for this file name; if empty, the chunks data will be appended directly to the document collection.', example='mydoc.txt'),
  namespace?: string(name='Namespace', description='Namespace, default is public.

> You can create it using the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API and view the list using the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) API.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='Password corresponding to the namespace.

> This value is specified by the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) API.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='Region ID where the instance is located.

This parameter is required.', example='cn-hangzhou'),
  textChunksShrink?: string(name='TextChunks', description='List of split documents.'),
}

model UpsertChunksResponseBody = {
  embeddingTokens?: string(name='EmbeddingTokens', description='Number of tokens used during vectorization.

> A token refers to the smallest unit into which the input text is divided. A token can be a word, a phrase, a punctuation mark, a character, etc.', example='100'),
  message?: string(name='Message', description='Return message.', example='Successful'),
  requestId?: string(name='RequestId', description='Request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='API execution status, with the following values:
- **success**: Execution succeeded.
- **fail**: Execution failed.', example='success'),
}

model UpsertChunksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpsertChunksResponseBody(name='body'),
}

/**
 * @summary Upload split text
 *
 * @description The vectorization algorithm for the document is specified by the CreateDocumentCollection API.
 *
 * @param tmpReq UpsertChunksRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpsertChunksResponse
 */
async function upsertChunksWithOptions(tmpReq: UpsertChunksRequest, runtime: Util.RuntimeOptions): UpsertChunksResponse {
  Util.validateModel(tmpReq);
  var request = new UpsertChunksShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.textChunks)) {
    request.textChunksShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.textChunks, 'TextChunks', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.textChunksShrink)) {
    body['TextChunks'] = request.textChunksShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpsertChunks',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Upload split text
 *
 * @description The vectorization algorithm for the document is specified by the CreateDocumentCollection API.
 *
 * @param request UpsertChunksRequest
 * @return UpsertChunksResponse
 */
async function upsertChunks(request: UpsertChunksRequest): UpsertChunksResponse {
  var runtime = new Util.RuntimeOptions{};
  return upsertChunksWithOptions(request, runtime);
}

model UpsertCollectionDataRequest {
  collection?: string(name='Collection', description='The name of the collection.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  rows?: [ 
    {
      id?: string(name='Id'),
      metadata?: map[string]string(name='Metadata'),
      sparseVector?: {
        indices?: [ long ](name='Indices'),
        values?: [ double ](name='Values'),
      }(name='SparseVector'),
      vector?: [ double ](name='Vector', description='This parameter is required.'),
    }
  ](name='Rows'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model UpsertCollectionDataShrinkRequest {
  collection?: string(name='Collection', description='The name of the collection.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

> You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the [CreateNamespace](https://help.aliyun.com/document_detail/2401495.html) operation to create a namespace and call the [ListNamespaces](https://help.aliyun.com/document_detail/2401502.html) operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

>  You can call the [DescribeRegions](https://help.aliyun.com/document_detail/86912.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  rowsShrink?: string(name='Rows'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.', example='gp-ws-*****'),
}

model UpsertCollectionDataResponseBody = {
  message?: string(name='Message', description='The returned message.', example='Successful'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='Indicates whether the request was successful. Valid values:

*   **success**
*   **fail**', example='success'),
}

model UpsertCollectionDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpsertCollectionDataResponseBody(name='body'),
}

/**
 * @summary Uploads vector data to a vector collection.
 *
 * @param tmpReq UpsertCollectionDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpsertCollectionDataResponse
 */
async function upsertCollectionDataWithOptions(tmpReq: UpsertCollectionDataRequest, runtime: Util.RuntimeOptions): UpsertCollectionDataResponse {
  Util.validateModel(tmpReq);
  var request = new UpsertCollectionDataShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.rows)) {
    request.rowsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.rows, 'Rows', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.collection)) {
    query['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    query['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    query['NamespacePassword'] = request.namespacePassword;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.rowsShrink)) {
    body['Rows'] = request.rowsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpsertCollectionData',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Uploads vector data to a vector collection.
 *
 * @param request UpsertCollectionDataRequest
 * @return UpsertCollectionDataResponse
 */
async function upsertCollectionData(request: UpsertCollectionDataRequest): UpsertCollectionDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return upsertCollectionDataWithOptions(request, runtime);
}

model UpsertCollectionDataAsyncRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  fileUrl?: string(name='FileUrl', description='The Internet-accessible vector data file URL.

> 

*   The file content must be in the JSONL format. Each line consists of a list of JSON data, which specifies a set of vector data.

*   Data format of each line: `{String Id; Map<String, Object> Metadata; List<Double> Vector}`. Example: `{"Id":"myid", "Metadata": {"my_meta_key": "my_meta_value"}, "Vector": [1.234, -0.123]}`.

*   We recommend that you use SDKs to call this operation. SDKs encapsulate the UpsertCollectionDataAsyncAdvance method to upload on-premises files as data sources.

This parameter is required.', example='https://xx/vectors.jsonl'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the Workspace composed of multiple database instances. This parameter and the DBInstanceId parameter cannot both be empty. When both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model UpsertCollectionDataAsyncAdvanceRequest {
  collection?: string(name='Collection', description='The name of the collection.

>  You can call the [ListCollections](https://help.aliyun.com/document_detail/2401503.html) operation to query a list of collections.

This parameter is required.', example='document'),
  DBInstanceId?: string(name='DBInstanceId', description='The instance ID.

>  You can call the [DescribeDBInstances](https://help.aliyun.com/document_detail/86911.html) operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.', example='gp-xxxxxxxxx'),
  fileUrlObject?: readable(name='FileUrl', description='The Internet-accessible vector data file URL.

> 

*   The file content must be in the JSONL format. Each line consists of a list of JSON data, which specifies a set of vector data.

*   Data format of each line: `{String Id; Map<String, Object> Metadata; List<Double> Vector}`. Example: `{"Id":"myid", "Metadata": {"my_meta_key": "my_meta_value"}, "Vector": [1.234, -0.123]}`.

*   We recommend that you use SDKs to call this operation. SDKs encapsulate the UpsertCollectionDataAsyncAdvance method to upload on-premises files as data sources.

This parameter is required.', example='https://xx/vectors.jsonl'),
  namespace?: string(name='Namespace', description='The name of the namespace. Default value: public.

>  You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.', example='mynamespace'),
  namespacePassword?: string(name='NamespacePassword', description='The password of the namespace.

>  The value of this parameter is specified when you call the CreateNamespace operation.

This parameter is required.', example='testpassword'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  workspaceId?: string(name='WorkspaceId', description='The ID of the Workspace composed of multiple database instances. This parameter and the DBInstanceId parameter cannot both be empty. When both are specified, this parameter takes precedence.', example='gp-ws-*****'),
}

model UpsertCollectionDataAsyncResponseBody = {
  jobId?: string(name='JobId', description='The job ID. It can be used to query the job status or cancel the job.', example='231460f8-75dc-405e-a669-0c5204887e91'),
  message?: string(name='Message', description='The returned message.', example='success'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABB39CC3-4488-4857-905D-2E4A051D0521'),
  status?: string(name='Status', description='The status of the operation. Valid values:

*   **success**
*   **fail**', example='success'),
}

model UpsertCollectionDataAsyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpsertCollectionDataAsyncResponseBody(name='body'),
}

/**
 * @summary Uploads vector data in an asynchronous manner by using an on-premises file or a password-free Internet-accessible file URL. The vector data can be up to 200 MB in size.
 *
 * @description This operation is the asynchronous operation of `UpsertCollectionData`. The `UpsertCollectionData` operation supports up to 10 MB of data, and this operation supports up to 200 MB of data.
 * >  Related operations:
 * *   You can call the GetUpsertCollectionDataJob operation to query the progress and result of an upload job.
 * *   You can call the CancelUpsertCollectionDataJob operation to cancel an upload job.
 * > You can upload data for the same collection only in a serial manner.
 *
 * @param request UpsertCollectionDataAsyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpsertCollectionDataAsyncResponse
 */
async function upsertCollectionDataAsyncWithOptions(request: UpsertCollectionDataAsyncRequest, runtime: Util.RuntimeOptions): UpsertCollectionDataAsyncResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.DBInstanceId)) {
    query['DBInstanceId'] = request.DBInstanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.collection)) {
    body['Collection'] = request.collection;
  }
  if (!Util.isUnset(request.fileUrl)) {
    body['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.namespacePassword)) {
    body['NamespacePassword'] = request.namespacePassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpsertCollectionDataAsync',
    version = '2016-05-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Uploads vector data in an asynchronous manner by using an on-premises file or a password-free Internet-accessible file URL. The vector data can be up to 200 MB in size.
 *
 * @description This operation is the asynchronous operation of `UpsertCollectionData`. The `UpsertCollectionData` operation supports up to 10 MB of data, and this operation supports up to 200 MB of data.
 * >  Related operations:
 * *   You can call the GetUpsertCollectionDataJob operation to query the progress and result of an upload job.
 * *   You can call the CancelUpsertCollectionDataJob operation to cancel an upload job.
 * > You can upload data for the same collection only in a serial manner.
 *
 * @param request UpsertCollectionDataAsyncRequest
 * @return UpsertCollectionDataAsyncResponse
 */
async function upsertCollectionDataAsync(request: UpsertCollectionDataAsyncRequest): UpsertCollectionDataAsyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return upsertCollectionDataAsyncWithOptions(request, runtime);
}

async function upsertCollectionDataAsyncAdvance(request: UpsertCollectionDataAsyncAdvanceRequest, runtime: Util.RuntimeOptions): UpsertCollectionDataAsyncResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'gpdb',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var upsertCollectionDataAsyncReq = new UpsertCollectionDataAsyncRequest{};
  OpenApiUtil.convert(request, upsertCollectionDataAsyncReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    upsertCollectionDataAsyncReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var upsertCollectionDataAsyncResp = upsertCollectionDataAsyncWithOptions(upsertCollectionDataAsyncReq, runtime);
  return upsertCollectionDataAsyncResp;
}

